@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/lib/src/sdk.d.ts
ADDED
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { Seaport } from "@opensea/seaport-js";
|
|
2
|
+
import type { OrderComponents } from "@opensea/seaport-js/lib/types";
|
|
3
|
+
import { type BigNumberish, type JsonRpcProvider, type Overrides, type Signer } from "ethers";
|
|
4
|
+
import { OpenSeaAPI } from "./api/api";
|
|
5
|
+
import type { CollectionOffer, Listing, Offer, Order } from "./api/types";
|
|
6
|
+
import type { OrderV2 } from "./orders/types";
|
|
7
|
+
import { type BulkOrderResult } from "./sdk/orders";
|
|
8
|
+
import { type AssetWithTokenId, type AssetWithTokenStandard, Chain, type EventData, EventType, type OpenSeaAPIConfig } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* The OpenSea SDK main class.
|
|
11
|
+
* @category Main Classes
|
|
12
|
+
*/
|
|
13
|
+
export declare class OpenSeaSDK {
|
|
14
|
+
/** Provider to use for transactions. */
|
|
15
|
+
provider: JsonRpcProvider;
|
|
16
|
+
/** Seaport client @see {@link https://github.com/ProjectOpenSea/seaport-js} */
|
|
17
|
+
seaport: Seaport;
|
|
18
|
+
/** Logger function to use when debugging */
|
|
19
|
+
logger: (arg: string) => void;
|
|
20
|
+
/** API instance */
|
|
21
|
+
readonly api: OpenSeaAPI;
|
|
22
|
+
/** The configured chain */
|
|
23
|
+
readonly chain: Chain;
|
|
24
|
+
/** Internal cache of decimals for payment tokens to save network requests */
|
|
25
|
+
private _cachedPaymentTokenDecimals;
|
|
26
|
+
private _emitter;
|
|
27
|
+
private _signerOrProvider;
|
|
28
|
+
private _tokensManager;
|
|
29
|
+
private _assetsManager;
|
|
30
|
+
private _cancellationManager;
|
|
31
|
+
private _ordersManager;
|
|
32
|
+
private _fulfillmentManager;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new instance of OpenSeaSDK.
|
|
35
|
+
* @param signerOrProvider Signer or provider to use for transactions. For example:
|
|
36
|
+
* `new ethers.providers.JsonRpcProvider('https://mainnet.infura.io')` or
|
|
37
|
+
* `new ethers.Wallet(privKey, provider)`
|
|
38
|
+
* @param apiConfig configuration options, including `chain`
|
|
39
|
+
* @param logger optional function for logging debug strings. defaults to no logging
|
|
40
|
+
*/
|
|
41
|
+
constructor(signerOrProvider: Signer | JsonRpcProvider, apiConfig?: OpenSeaAPIConfig, logger?: (arg: string) => void);
|
|
42
|
+
/**
|
|
43
|
+
* Add a listener for events emitted by the SDK.
|
|
44
|
+
* @param event The {@link EventType} to listen to.
|
|
45
|
+
* @param listener A callback that will accept an object with {@link EventData}\
|
|
46
|
+
* @param once Whether the listener should only be called once, or continue listening until removed.
|
|
47
|
+
*/
|
|
48
|
+
addListener(event: EventType, listener: (data: EventData) => void, once?: boolean): void;
|
|
49
|
+
/**
|
|
50
|
+
* Remove an event listener by calling `.removeListener()` on an event and listener.
|
|
51
|
+
* @param event The {@link EventType} to remove a listener for\
|
|
52
|
+
* @param listener The listener to remove
|
|
53
|
+
*/
|
|
54
|
+
removeListener(event: EventType, listener: (data: EventData) => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* Remove all event listeners. This should be called when you're unmounting
|
|
57
|
+
* a component that listens to events to make UI updates.
|
|
58
|
+
* @param event Optional EventType to remove listeners for
|
|
59
|
+
*/
|
|
60
|
+
removeAllListeners(event?: EventType): void;
|
|
61
|
+
/**
|
|
62
|
+
* Wrap native asset into wrapped native asset (e.g. ETH into WETH, POL into WPOL).
|
|
63
|
+
* Wrapped native assets are needed for making offers.
|
|
64
|
+
* @param options
|
|
65
|
+
* @param options.amountInEth Amount of native asset to wrap
|
|
66
|
+
* @param options.accountAddress Address of the user's wallet containing the native asset
|
|
67
|
+
*/
|
|
68
|
+
wrapEth({ amountInEth, accountAddress, }: {
|
|
69
|
+
amountInEth: BigNumberish;
|
|
70
|
+
accountAddress: string;
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Unwrap wrapped native asset into native asset (e.g. WETH into ETH, WPOL into POL).
|
|
74
|
+
* Emits the `UnwrapWeth` event when the transaction is prompted.
|
|
75
|
+
* @param options
|
|
76
|
+
* @param options.amountInEth How much wrapped native asset to unwrap
|
|
77
|
+
* @param options.accountAddress Address of the user's wallet containing the wrapped native asset
|
|
78
|
+
*/
|
|
79
|
+
unwrapWeth({ amountInEth, accountAddress, }: {
|
|
80
|
+
amountInEth: BigNumberish;
|
|
81
|
+
accountAddress: string;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Create and submit an offer on an asset.
|
|
85
|
+
* @param options
|
|
86
|
+
* @param options.asset The asset to trade. tokenAddress and tokenId must be defined.
|
|
87
|
+
* @param options.accountAddress Address of the wallet making the offer.
|
|
88
|
+
* @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
|
|
89
|
+
* @param options.quantity Number of assets to bid for. Defaults to 1.
|
|
90
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in salt.
|
|
91
|
+
* @param options.salt Arbitrary salt. Auto-generated if not provided.
|
|
92
|
+
* @param options.expirationTime Expiration time for the order, in UTC seconds
|
|
93
|
+
* @param options.zone Zone for order protection. Defaults to chain's signed zone.
|
|
94
|
+
*
|
|
95
|
+
* @returns The {@link OrderV2} that was created.
|
|
96
|
+
*
|
|
97
|
+
* @throws Error if the asset does not contain a token id.
|
|
98
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
99
|
+
* @throws Error if the amount is not greater than 0.
|
|
100
|
+
*/
|
|
101
|
+
createOffer({ asset, accountAddress, amount, quantity, domain, salt, expirationTime, zone, }: {
|
|
102
|
+
asset: AssetWithTokenId;
|
|
103
|
+
accountAddress: string;
|
|
104
|
+
amount: BigNumberish;
|
|
105
|
+
quantity?: BigNumberish;
|
|
106
|
+
domain?: string;
|
|
107
|
+
salt?: BigNumberish;
|
|
108
|
+
expirationTime?: BigNumberish;
|
|
109
|
+
zone?: string;
|
|
110
|
+
}): Promise<OrderV2>;
|
|
111
|
+
/**
|
|
112
|
+
* Create and submit a listing for an asset.
|
|
113
|
+
* @param options
|
|
114
|
+
* @param options.asset The asset to trade. tokenAddress and tokenId must be defined.
|
|
115
|
+
* @param options.accountAddress Address of the wallet making the listing
|
|
116
|
+
* @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
|
|
117
|
+
* @param options.quantity Number of assets to list. Defaults to 1.
|
|
118
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in salt.
|
|
119
|
+
* @param options.salt Arbitrary salt. Auto-generated if not provided.
|
|
120
|
+
* @param options.listingTime Optional time when the order will become fulfillable, in UTC seconds. Undefined means it will start now.
|
|
121
|
+
* @param options.expirationTime Expiration time for the order, in UTC seconds.
|
|
122
|
+
* @param options.buyerAddress Optional address that's allowed to purchase this item. If specified, no other address will be able to take the order, unless its value is the null address.
|
|
123
|
+
* @param options.includeOptionalCreatorFees If true, optional creator fees will be included in the listing. Default: false.
|
|
124
|
+
* @param options.zone Zone for order protection. Defaults to no zone.
|
|
125
|
+
* @returns The {@link OrderV2} that was created.
|
|
126
|
+
*
|
|
127
|
+
* @throws Error if the asset does not contain a token id.
|
|
128
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
129
|
+
* @throws Error if the amount is not greater than 0.
|
|
130
|
+
*/
|
|
131
|
+
createListing({ asset, accountAddress, amount, quantity, domain, salt, listingTime, expirationTime, buyerAddress, includeOptionalCreatorFees, zone, }: {
|
|
132
|
+
asset: AssetWithTokenId;
|
|
133
|
+
accountAddress: string;
|
|
134
|
+
amount: BigNumberish;
|
|
135
|
+
quantity?: BigNumberish;
|
|
136
|
+
domain?: string;
|
|
137
|
+
salt?: BigNumberish;
|
|
138
|
+
listingTime?: number;
|
|
139
|
+
expirationTime?: number;
|
|
140
|
+
buyerAddress?: string;
|
|
141
|
+
includeOptionalCreatorFees?: boolean;
|
|
142
|
+
zone?: string;
|
|
143
|
+
}): Promise<OrderV2>;
|
|
144
|
+
/**
|
|
145
|
+
* Create and submit multiple listings using Seaport's bulk order creation.
|
|
146
|
+
* This method uses a single signature for all listings and submits them individually to the OpenSea API with rate limit handling.
|
|
147
|
+
* All listings must be from the same account address.
|
|
148
|
+
*
|
|
149
|
+
* Note: If only one listing is provided, this method will use a normal order signature instead of a bulk signature,
|
|
150
|
+
* as bulk signatures are more expensive to decode on-chain due to the merkle proof verification.
|
|
151
|
+
*
|
|
152
|
+
* @param options
|
|
153
|
+
* @param options.listings Array of listing parameters. Each listing requires asset, amount, and optionally other listing parameters.
|
|
154
|
+
* @param options.accountAddress Address of the wallet making the listings
|
|
155
|
+
* @param options.continueOnError If true, continue submitting remaining listings even if some fail. Default: false (throw on first error).
|
|
156
|
+
* @param options.onProgress Optional callback for progress updates. Called after each listing is submitted (successfully or not).
|
|
157
|
+
* @returns {@link BulkOrderResult} containing successful orders and any failures.
|
|
158
|
+
*
|
|
159
|
+
* @throws Error if listings array is empty
|
|
160
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
161
|
+
* @throws Error if any asset does not contain a token id.
|
|
162
|
+
* @throws Error if continueOnError is false and any submission fails.
|
|
163
|
+
*/
|
|
164
|
+
createBulkListings({ listings, accountAddress, continueOnError, onProgress, }: {
|
|
165
|
+
listings: Array<{
|
|
166
|
+
asset: AssetWithTokenId;
|
|
167
|
+
amount: BigNumberish;
|
|
168
|
+
quantity?: BigNumberish;
|
|
169
|
+
domain?: string;
|
|
170
|
+
salt?: BigNumberish;
|
|
171
|
+
listingTime?: number;
|
|
172
|
+
expirationTime?: number;
|
|
173
|
+
buyerAddress?: string;
|
|
174
|
+
includeOptionalCreatorFees?: boolean;
|
|
175
|
+
zone?: string;
|
|
176
|
+
}>;
|
|
177
|
+
accountAddress: string;
|
|
178
|
+
continueOnError?: boolean;
|
|
179
|
+
onProgress?: (completed: number, total: number) => void;
|
|
180
|
+
}): Promise<BulkOrderResult>;
|
|
181
|
+
/**
|
|
182
|
+
* Create and submit multiple offers using Seaport's bulk order creation.
|
|
183
|
+
* This method uses a single signature for all offers and submits them individually to the OpenSea API with rate limit handling.
|
|
184
|
+
* All offers must be from the same account address.
|
|
185
|
+
*
|
|
186
|
+
* Note: If only one offer is provided, this method will use a normal order signature instead of a bulk signature,
|
|
187
|
+
* as bulk signatures are more expensive to decode on-chain due to the merkle proof verification.
|
|
188
|
+
*
|
|
189
|
+
* @param options
|
|
190
|
+
* @param options.offers Array of offer parameters. Each offer requires asset, amount, and optionally other offer parameters.
|
|
191
|
+
* @param options.accountAddress Address of the wallet making the offers
|
|
192
|
+
* @param options.continueOnError If true, continue submitting remaining offers even if some fail. Default: false (throw on first error).
|
|
193
|
+
* @param options.onProgress Optional callback for progress updates. Called after each offer is submitted (successfully or not).
|
|
194
|
+
* @returns {@link BulkOrderResult} containing successful orders and any failures.
|
|
195
|
+
*
|
|
196
|
+
* @throws Error if offers array is empty
|
|
197
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
198
|
+
* @throws Error if any asset does not contain a token id.
|
|
199
|
+
* @throws Error if continueOnError is false and any submission fails.
|
|
200
|
+
*/
|
|
201
|
+
createBulkOffers({ offers, accountAddress, continueOnError, onProgress, }: {
|
|
202
|
+
offers: Array<{
|
|
203
|
+
asset: AssetWithTokenId;
|
|
204
|
+
amount: BigNumberish;
|
|
205
|
+
quantity?: BigNumberish;
|
|
206
|
+
domain?: string;
|
|
207
|
+
salt?: BigNumberish;
|
|
208
|
+
expirationTime?: BigNumberish;
|
|
209
|
+
zone?: string;
|
|
210
|
+
}>;
|
|
211
|
+
accountAddress: string;
|
|
212
|
+
continueOnError?: boolean;
|
|
213
|
+
onProgress?: (completed: number, total: number) => void;
|
|
214
|
+
}): Promise<BulkOrderResult>;
|
|
215
|
+
/**
|
|
216
|
+
* Create and submit a collection offer.
|
|
217
|
+
* @param options
|
|
218
|
+
* @param options.collectionSlug Identifier for the collection.
|
|
219
|
+
* @param options.accountAddress Address of the wallet making the offer.
|
|
220
|
+
* @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
|
|
221
|
+
* @param options.quantity Number of assets to bid for.
|
|
222
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in salt.
|
|
223
|
+
* @param options.salt Arbitrary salt. Auto-generated if not provided.
|
|
224
|
+
* @param options.expirationTime Expiration time (UTC seconds).
|
|
225
|
+
* @param options.offerProtectionEnabled Use signed zone for protection against disabled items. Default: true.
|
|
226
|
+
* @param options.traitType If defined, the trait name to create the collection offer for.
|
|
227
|
+
* @param options.traitValue If defined, the trait value to create the collection offer for.
|
|
228
|
+
* @param options.traits If defined, an array of traits to create the multi-trait collection offer for.
|
|
229
|
+
* @param options.numericTraits If defined, an array of numeric trait criteria with min/max ranges.
|
|
230
|
+
* @returns The {@link CollectionOffer} that was created.
|
|
231
|
+
*/
|
|
232
|
+
createCollectionOffer({ collectionSlug, accountAddress, amount, quantity, domain, salt, expirationTime, offerProtectionEnabled, traitType, traitValue, traits, numericTraits, }: {
|
|
233
|
+
collectionSlug: string;
|
|
234
|
+
accountAddress: string;
|
|
235
|
+
amount: BigNumberish;
|
|
236
|
+
quantity: number;
|
|
237
|
+
domain?: string;
|
|
238
|
+
salt?: BigNumberish;
|
|
239
|
+
expirationTime?: number | string;
|
|
240
|
+
offerProtectionEnabled?: boolean;
|
|
241
|
+
traitType?: string;
|
|
242
|
+
traitValue?: string;
|
|
243
|
+
traits?: Array<{
|
|
244
|
+
type: string;
|
|
245
|
+
value: string;
|
|
246
|
+
}>;
|
|
247
|
+
numericTraits?: Array<{
|
|
248
|
+
type: string;
|
|
249
|
+
min?: number;
|
|
250
|
+
max?: number;
|
|
251
|
+
}>;
|
|
252
|
+
}): Promise<CollectionOffer | null>;
|
|
253
|
+
/**
|
|
254
|
+
* Fulfill an order for an asset. The order can be either a listing or an offer.
|
|
255
|
+
* Uses the OpenSea API to generate fulfillment transaction data and executes it directly.
|
|
256
|
+
* @param options
|
|
257
|
+
* @param options.order The order to fulfill, a.k.a. "take"
|
|
258
|
+
* @param options.accountAddress Address of the wallet taking the offer.
|
|
259
|
+
* @param options.assetContractAddress Optional address of the NFT contract for criteria offers (e.g., collection offers). Required when fulfilling collection offers.
|
|
260
|
+
* @param options.tokenId Optional token ID for criteria offers (e.g., collection offers). Required when fulfilling collection offers.
|
|
261
|
+
* @param options.unitsToFill Optional number of units to fill. Defaults to 1 for both listings and offers.
|
|
262
|
+
* @param options.recipientAddress Optional recipient address for the NFT when fulfilling a listing. Not applicable for offers.
|
|
263
|
+
* @param options.includeOptionalCreatorFees Whether to include optional creator fees in the fulfillment. If creator fees are already required, this is a no-op. Defaults to false.
|
|
264
|
+
* @param options.overrides Transaction overrides, ignored if not set.
|
|
265
|
+
* @returns Transaction hash of the order.
|
|
266
|
+
*
|
|
267
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
268
|
+
* @throws Error if the order's protocol address is not supported by OpenSea. See {@link isValidProtocol}.
|
|
269
|
+
* @throws Error if a signer is not provided (read-only providers cannot fulfill orders).
|
|
270
|
+
* @throws Error if the order hash is not available.
|
|
271
|
+
*/
|
|
272
|
+
fulfillOrder({ order, accountAddress, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees, overrides, }: {
|
|
273
|
+
order: OrderV2 | Order | Listing | Offer;
|
|
274
|
+
accountAddress: string;
|
|
275
|
+
assetContractAddress?: string;
|
|
276
|
+
tokenId?: string;
|
|
277
|
+
unitsToFill?: BigNumberish;
|
|
278
|
+
recipientAddress?: string;
|
|
279
|
+
includeOptionalCreatorFees?: boolean;
|
|
280
|
+
overrides?: Overrides;
|
|
281
|
+
}): Promise<string>;
|
|
282
|
+
/**
|
|
283
|
+
* Cancel multiple orders onchain, preventing them from being fulfilled.
|
|
284
|
+
* This method accepts either full OrderV2 objects, OrderComponents, or order hashes with protocol address.
|
|
285
|
+
*
|
|
286
|
+
* **Event Behavior**: For backwards compatibility with the singular `cancelOrder` method,
|
|
287
|
+
* this method dispatches a `CancelOrder` event for the first order only, and only when
|
|
288
|
+
* an OrderV2 object is available (either provided directly or fetched via orderHashes).
|
|
289
|
+
* No event is dispatched when using OrderComponents directly, as they lack the full order data.
|
|
290
|
+
*
|
|
291
|
+
* @param options
|
|
292
|
+
* @param options.orders Array of orders to cancel. Can be OrderV2 objects or OrderComponents.
|
|
293
|
+
* @param options.orderHashes Optional array of order hashes to cancel. Must provide protocolAddress if using this.
|
|
294
|
+
* @param options.accountAddress The account address cancelling the orders.
|
|
295
|
+
* @param options.protocolAddress Required when using orderHashes. The Seaport protocol address for the orders.
|
|
296
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in calldata.
|
|
297
|
+
* @param options.overrides Transaction overrides, ignored if not set.
|
|
298
|
+
* @returns Transaction hash of the cancellation.
|
|
299
|
+
*
|
|
300
|
+
* @throws Error if orderHashes is provided without protocolAddress.
|
|
301
|
+
* @throws Error if neither orders nor orderHashes is provided.
|
|
302
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
303
|
+
* @throws Error if the order's protocol address is not supported by OpenSea. See {@link isValidProtocol}.
|
|
304
|
+
*/
|
|
305
|
+
cancelOrders({ orders, orderHashes, accountAddress, protocolAddress, domain, overrides, }: {
|
|
306
|
+
orders?: Array<OrderV2 | OrderComponents>;
|
|
307
|
+
orderHashes?: string[];
|
|
308
|
+
accountAddress: string;
|
|
309
|
+
protocolAddress?: string;
|
|
310
|
+
domain?: string;
|
|
311
|
+
overrides?: Overrides;
|
|
312
|
+
}): Promise<string>;
|
|
313
|
+
/**
|
|
314
|
+
* Cancel an order onchain, preventing it from ever being fulfilled.
|
|
315
|
+
* This method accepts either a full OrderV2 object or an order hash with protocol address.
|
|
316
|
+
*
|
|
317
|
+
* @param options
|
|
318
|
+
* @param options.order The order to cancel (OrderV2 object)
|
|
319
|
+
* @param options.orderHash Optional order hash to cancel. Must provide protocolAddress if using this.
|
|
320
|
+
* @param options.accountAddress The account address that will be cancelling the order.
|
|
321
|
+
* @param options.protocolAddress Required when using orderHash. The Seaport protocol address for the order.
|
|
322
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in calldata.
|
|
323
|
+
*
|
|
324
|
+
* @throws Error if neither order nor orderHash is provided.
|
|
325
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
326
|
+
* @throws Error if the order's protocol address is not supported by OpenSea. See {@link isValidProtocol}.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* // Cancel using OrderV2 object
|
|
330
|
+
* await sdk.cancelOrder({
|
|
331
|
+
* order: orderV2Object,
|
|
332
|
+
* accountAddress: "0x..."
|
|
333
|
+
* });
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* // Cancel using order hash
|
|
337
|
+
* await sdk.cancelOrder({
|
|
338
|
+
* orderHash: "0x123...",
|
|
339
|
+
* protocolAddress: "0xabc...",
|
|
340
|
+
* accountAddress: "0x..."
|
|
341
|
+
* });
|
|
342
|
+
*/
|
|
343
|
+
cancelOrder({ order, orderHash, accountAddress, protocolAddress, domain, }: {
|
|
344
|
+
order?: OrderV2;
|
|
345
|
+
orderHash?: string;
|
|
346
|
+
accountAddress: string;
|
|
347
|
+
protocolAddress?: string;
|
|
348
|
+
domain?: string;
|
|
349
|
+
}): Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* Offchain cancel an order, offer or listing, by its order hash when protected by the SignedZone.
|
|
352
|
+
* Protocol and Chain are required to prevent hash collisions.
|
|
353
|
+
* Please note cancellation is only assured if a fulfillment signature was not vended prior to cancellation.
|
|
354
|
+
* @param protocolAddress The Seaport address for the order.
|
|
355
|
+
* @param orderHash The order hash, or external identifier, of the order.
|
|
356
|
+
* @param chain The chain where the order is located.
|
|
357
|
+
* @param offererSignature An EIP-712 signature from the offerer of the order.
|
|
358
|
+
* If this is not provided, the API key used to initialize the SDK must belong to the order's offerer.
|
|
359
|
+
* The signature must be a EIP-712 signature consisting of the order's Seaport contract's
|
|
360
|
+
* name, version, address, and chain. The struct to sign is `OrderHash` containing a
|
|
361
|
+
* single bytes32 field.
|
|
362
|
+
* @param useSignerToDeriveOffererSignature Derive the offererSignature from the Ethers signer passed into this sdk.
|
|
363
|
+
* @returns The response from the API.
|
|
364
|
+
*/
|
|
365
|
+
offchainCancelOrder(protocolAddress: string, orderHash: string, chain?: Chain, offererSignature?: string, useSignerToDeriveOffererSignature?: boolean): Promise<import("./api/types").CancelOrderResponse>;
|
|
366
|
+
/**
|
|
367
|
+
* Returns whether an order is fulfillable.
|
|
368
|
+
* An order may not be fulfillable if a target item's transfer function
|
|
369
|
+
* is locked for some reason, e.g. an item is being rented within a game
|
|
370
|
+
* or trading has been locked for an item type.
|
|
371
|
+
* @param options
|
|
372
|
+
* @param options.order Order to check
|
|
373
|
+
* @param options.accountAddress The account address that will be fulfilling the order
|
|
374
|
+
* @returns True if the order is fulfillable, else False.
|
|
375
|
+
*
|
|
376
|
+
* @throws Error if the order's protocol address is not supported by OpenSea. See {@link isValidProtocol}.
|
|
377
|
+
*/
|
|
378
|
+
isOrderFulfillable({ order, accountAddress, }: {
|
|
379
|
+
order: OrderV2;
|
|
380
|
+
accountAddress: string;
|
|
381
|
+
}): Promise<boolean>;
|
|
382
|
+
/**
|
|
383
|
+
* Get an account's balance of any Asset. This asset can be an ERC20, ERC1155, or ERC721.
|
|
384
|
+
* @param options
|
|
385
|
+
* @param options.accountAddress Account address to check
|
|
386
|
+
* @param options.asset The Asset to check balance for. tokenStandard must be set.
|
|
387
|
+
* @returns The balance of the asset for the account.
|
|
388
|
+
*
|
|
389
|
+
* @throws Error if the token standard does not support balanceOf.
|
|
390
|
+
*/
|
|
391
|
+
getBalance({ accountAddress, asset, }: {
|
|
392
|
+
accountAddress: string;
|
|
393
|
+
asset: AssetWithTokenStandard;
|
|
394
|
+
}): Promise<bigint>;
|
|
395
|
+
/**
|
|
396
|
+
* Transfer an asset. This asset can be an ERC20, ERC1155, or ERC721.
|
|
397
|
+
* @param options
|
|
398
|
+
* @param options.asset The Asset to transfer. tokenStandard must be set.
|
|
399
|
+
* @param options.amount Amount of asset to transfer. Not used for ERC721.
|
|
400
|
+
* @param options.fromAddress The address to transfer from
|
|
401
|
+
* @param options.toAddress The address to transfer to
|
|
402
|
+
* @param options.overrides Transaction overrides, ignored if not set.
|
|
403
|
+
*/
|
|
404
|
+
transfer({ asset, amount, fromAddress, toAddress, overrides, }: {
|
|
405
|
+
asset: AssetWithTokenStandard;
|
|
406
|
+
amount?: BigNumberish;
|
|
407
|
+
fromAddress: string;
|
|
408
|
+
toAddress: string;
|
|
409
|
+
overrides?: Overrides;
|
|
410
|
+
}): Promise<void>;
|
|
411
|
+
/**
|
|
412
|
+
* Bulk transfer multiple assets using OpenSea's TransferHelper contract.
|
|
413
|
+
* This method is more gas-efficient than calling transfer() multiple times.
|
|
414
|
+
* Note: All assets must be approved for transfer to the OpenSea conduit before calling this method.
|
|
415
|
+
* @param options
|
|
416
|
+
* @param options.assets Array of assets to transfer. Each asset must have tokenStandard set.
|
|
417
|
+
* @param options.fromAddress The address to transfer from
|
|
418
|
+
* @param options.overrides Transaction overrides, ignored if not set.
|
|
419
|
+
* @returns Transaction hash of the bulk transfer
|
|
420
|
+
*
|
|
421
|
+
* @throws Error if any asset is missing required fields (tokenId for NFTs, amount for ERC20/ERC1155).
|
|
422
|
+
* @throws Error if any asset is not approved for transfer to the OpenSea conduit.
|
|
423
|
+
* @throws Error if the fromAddress is not available through wallet or provider.
|
|
424
|
+
*/
|
|
425
|
+
bulkTransfer({ assets, fromAddress, overrides, }: {
|
|
426
|
+
assets: Array<{
|
|
427
|
+
asset: AssetWithTokenStandard;
|
|
428
|
+
toAddress: string;
|
|
429
|
+
amount?: BigNumberish;
|
|
430
|
+
}>;
|
|
431
|
+
fromAddress: string;
|
|
432
|
+
overrides?: Overrides;
|
|
433
|
+
}): Promise<string>;
|
|
434
|
+
/**
|
|
435
|
+
* Batch approve multiple assets for transfer to the OpenSea conduit.
|
|
436
|
+
* This method checks which assets need approval and batches them efficiently:
|
|
437
|
+
* - 0 approvals needed: Returns early
|
|
438
|
+
* - 1 approval needed: Sends single transaction
|
|
439
|
+
* - 2+ approvals needed: Uses Multicall3 to batch all approvals in one transaction
|
|
440
|
+
*
|
|
441
|
+
* @param options
|
|
442
|
+
* @param options.assets Array of assets to approve for transfer
|
|
443
|
+
* @param options.fromAddress The address that owns the assets
|
|
444
|
+
* @param options.overrides Transaction overrides, ignored if not set.
|
|
445
|
+
* @returns Transaction hash of the approval transaction, or undefined if no approvals needed
|
|
446
|
+
*
|
|
447
|
+
* @throws Error if the fromAddress is not available through wallet or provider.
|
|
448
|
+
*/
|
|
449
|
+
batchApproveAssets({ assets, fromAddress, overrides, }: {
|
|
450
|
+
assets: Array<{
|
|
451
|
+
asset: AssetWithTokenStandard;
|
|
452
|
+
amount?: BigNumberish;
|
|
453
|
+
}>;
|
|
454
|
+
fromAddress: string;
|
|
455
|
+
overrides?: Overrides;
|
|
456
|
+
}): Promise<string | undefined>;
|
|
457
|
+
/**
|
|
458
|
+
* Instead of signing an off-chain order, this method allows you to approve an order
|
|
459
|
+
* with an on-chain transaction.
|
|
460
|
+
* @param order Order to approve
|
|
461
|
+
* @param domain An optional domain to be hashed and included at the end of fulfillment calldata. This can be used for on-chain order attribution to assist with analytics.
|
|
462
|
+
* @returns Transaction hash of the approval transaction
|
|
463
|
+
*
|
|
464
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
465
|
+
* @throws Error if the order's protocol address is not supported by OpenSea. See {@link isValidProtocol}.
|
|
466
|
+
*/
|
|
467
|
+
approveOrder(order: OrderV2, domain?: string): Promise<string>;
|
|
468
|
+
/**
|
|
469
|
+
* Validates an order onchain using Seaport's validate() method. This submits the order onchain
|
|
470
|
+
* and pre-validates the order using Seaport, which makes it cheaper to fulfill since a signature
|
|
471
|
+
* is not needed to be verified during fulfillment for the order, but is not strictly required
|
|
472
|
+
* and the alternative is orders can be submitted to the API for free instead of sent onchain.
|
|
473
|
+
* @param orderComponents Order components to validate onchain
|
|
474
|
+
* @param accountAddress Address of the wallet that will pay the gas to validate the order
|
|
475
|
+
* @returns Transaction hash of the validation transaction
|
|
476
|
+
*
|
|
477
|
+
* @throws Error if the accountAddress is not available through wallet or provider.
|
|
478
|
+
*/
|
|
479
|
+
validateOrderOnchain(orderComponents: OrderComponents, accountAddress: string): Promise<string>;
|
|
480
|
+
/**
|
|
481
|
+
* Create and validate a listing onchain. Combines order building with onchain validation.
|
|
482
|
+
* Validation costs gas upfront but makes fulfillment cheaper (no signature verification needed).
|
|
483
|
+
* @param options
|
|
484
|
+
* @param options.asset The asset to trade. tokenAddress and tokenId must be defined.
|
|
485
|
+
* @param options.accountAddress Address of the wallet making the listing
|
|
486
|
+
* @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
|
|
487
|
+
* @param options.quantity Number of assets to list. Defaults to 1.
|
|
488
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in salt.
|
|
489
|
+
* @param options.salt Arbitrary salt. Auto-generated if not provided.
|
|
490
|
+
* @param options.listingTime When order becomes fulfillable (UTC seconds). Defaults to now.
|
|
491
|
+
* @param options.expirationTime Expiration time (UTC seconds).
|
|
492
|
+
* @param options.buyerAddress Optional buyer restriction. Only this address can purchase.
|
|
493
|
+
* @param options.includeOptionalCreatorFees Include optional creator fees. Default: false.
|
|
494
|
+
* @param options.zone Zone for order protection. Defaults to no zone.
|
|
495
|
+
* @returns Transaction hash
|
|
496
|
+
*
|
|
497
|
+
* @throws Error if asset missing token id or accountAddress unavailable.
|
|
498
|
+
*/
|
|
499
|
+
createListingAndValidateOnchain({ asset, accountAddress, amount, quantity, domain, salt, listingTime, expirationTime, buyerAddress, includeOptionalCreatorFees, zone, }: {
|
|
500
|
+
asset: AssetWithTokenId;
|
|
501
|
+
accountAddress: string;
|
|
502
|
+
amount: BigNumberish;
|
|
503
|
+
quantity?: BigNumberish;
|
|
504
|
+
domain?: string;
|
|
505
|
+
salt?: BigNumberish;
|
|
506
|
+
listingTime?: number;
|
|
507
|
+
expirationTime?: number;
|
|
508
|
+
buyerAddress?: string;
|
|
509
|
+
includeOptionalCreatorFees?: boolean;
|
|
510
|
+
zone?: string;
|
|
511
|
+
}): Promise<string>;
|
|
512
|
+
/**
|
|
513
|
+
* Create and validate an offer onchain. Combines order building with onchain validation.
|
|
514
|
+
* Validation costs gas upfront but makes fulfillment cheaper (no signature verification needed).
|
|
515
|
+
* @param options
|
|
516
|
+
* @param options.asset The asset to trade. tokenAddress and tokenId must be defined.
|
|
517
|
+
* @param options.accountAddress Address of the wallet making the offer.
|
|
518
|
+
* @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
|
|
519
|
+
* @param options.quantity Number of assets to bid for. Defaults to 1.
|
|
520
|
+
* @param options.domain Optional domain for on-chain attribution. Hashed and included in salt.
|
|
521
|
+
* @param options.salt Arbitrary salt. Auto-generated if not provided.
|
|
522
|
+
* @param options.expirationTime Expiration time (UTC seconds).
|
|
523
|
+
* @param options.zone Zone for order protection. Defaults to chain's signed zone.
|
|
524
|
+
* @returns Transaction hash
|
|
525
|
+
*
|
|
526
|
+
* @throws Error if asset missing token id or accountAddress unavailable.
|
|
527
|
+
*/
|
|
528
|
+
createOfferAndValidateOnchain({ asset, accountAddress, amount, quantity, domain, salt, expirationTime, zone, }: {
|
|
529
|
+
asset: AssetWithTokenId;
|
|
530
|
+
accountAddress: string;
|
|
531
|
+
amount: BigNumberish;
|
|
532
|
+
quantity?: BigNumberish;
|
|
533
|
+
domain?: string;
|
|
534
|
+
salt?: BigNumberish;
|
|
535
|
+
expirationTime?: BigNumberish;
|
|
536
|
+
zone?: string;
|
|
537
|
+
}): Promise<string>;
|
|
538
|
+
/**
|
|
539
|
+
* Compute the `basePrice` parameter to be used to price an order.
|
|
540
|
+
* Also validates the price and token address.
|
|
541
|
+
* @param tokenAddress Address of the ERC-20 token to use for trading. Use the null address for ETH.
|
|
542
|
+
* @param amount The value for the order, in the token's main units (e.g. ETH instead of wei)
|
|
543
|
+
*/
|
|
544
|
+
private _getPriceParameters;
|
|
545
|
+
private _dispatch;
|
|
546
|
+
/** Get the accounts available from the signer or provider. */
|
|
547
|
+
private _getAvailableAccounts;
|
|
548
|
+
/**
|
|
549
|
+
* Throws an error if an account is not available through the provider.
|
|
550
|
+
* @param accountAddress The account address to check is available.
|
|
551
|
+
*/
|
|
552
|
+
private _requireAccountIsAvailable;
|
|
553
|
+
/**
|
|
554
|
+
* Wait for a transaction to confirm and log the success or failure.
|
|
555
|
+
* @param transactionHash The transaction hash to wait for.
|
|
556
|
+
* @param event The event type to log.
|
|
557
|
+
* @param description The description of the transaction.
|
|
558
|
+
*/
|
|
559
|
+
private _confirmTransaction;
|
|
560
|
+
}
|