opensea-js 4.0.21 → 4.0.22

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.
Files changed (123) hide show
  1. package/lib/abi/CanonicalWETH.d.ts +2 -0
  2. package/lib/abi/CanonicalWETH.js +157 -0
  3. package/lib/abi/CanonicalWETH.js.map +1 -0
  4. package/lib/abi/ERC1155.d.ts +2 -0
  5. package/lib/abi/ERC1155.js +9 -0
  6. package/lib/abi/ERC1155.js.map +1 -0
  7. package/lib/abi/ERC1155Abi.json +2346 -0
  8. package/lib/abi/ERC20.d.ts +2 -0
  9. package/lib/abi/ERC20.js +141 -0
  10. package/lib/abi/ERC20.js.map +1 -0
  11. package/lib/abi/ERC721v3.d.ts +2 -0
  12. package/lib/abi/ERC721v3.js +9 -0
  13. package/lib/abi/ERC721v3.js.map +1 -0
  14. package/lib/abi/ERC721v3Abi.json +470 -0
  15. package/lib/abi/Proxy.d.ts +27 -0
  16. package/lib/abi/Proxy.js +30 -0
  17. package/lib/abi/Proxy.js.map +1 -0
  18. package/lib/abi/UniswapExchange.d.ts +2 -0
  19. package/lib/abi/UniswapExchange.js +9 -0
  20. package/lib/abi/UniswapExchange.js.map +1 -0
  21. package/lib/abi/UniswapExchangeAbi.json +451 -0
  22. package/lib/abi/UniswapFactory.d.ts +2 -0
  23. package/lib/abi/UniswapFactory.js +9 -0
  24. package/lib/abi/UniswapFactory.js.map +1 -0
  25. package/lib/abi/UniswapFactoryAbi.json +67 -0
  26. package/lib/abi/WrappedNFT.d.ts +2 -0
  27. package/lib/abi/WrappedNFT.js +9 -0
  28. package/lib/abi/WrappedNFT.js.map +1 -0
  29. package/lib/abi/WrappedNFTAbi.json +331 -0
  30. package/lib/abi/WrappedNFTFactory.d.ts +2 -0
  31. package/lib/abi/WrappedNFTFactory.js +9 -0
  32. package/lib/abi/WrappedNFTFactory.js.map +1 -0
  33. package/lib/abi/WrappedNFTFactoryAbi.json +250 -0
  34. package/lib/abi/WrappedNFTLiquidationProxy.d.ts +2 -0
  35. package/lib/abi/WrappedNFTLiquidationProxy.js +139 -0
  36. package/lib/abi/WrappedNFTLiquidationProxy.js.map +1 -0
  37. package/lib/api.d.ts +134 -0
  38. package/lib/api.js +509 -0
  39. package/lib/api.js.map +1 -0
  40. package/lib/constants.d.ts +56 -0
  41. package/lib/constants.js +89 -0
  42. package/lib/constants.js.map +1 -0
  43. package/lib/contracts.d.ts +12 -0
  44. package/lib/contracts.js +32 -0
  45. package/lib/contracts.js.map +1 -0
  46. package/lib/debugging.d.ts +22 -0
  47. package/lib/debugging.js +194 -0
  48. package/lib/debugging.js.map +1 -0
  49. package/lib/index.d.ts +17 -0
  50. package/lib/index.js +25 -0
  51. package/lib/index.js.map +1 -0
  52. package/lib/orders/privateListings.d.ts +4 -0
  53. package/lib/orders/privateListings.js +129 -0
  54. package/lib/orders/privateListings.js.map +1 -0
  55. package/lib/orders/schemas.d.ts +3 -0
  56. package/lib/orders/schemas.js +78 -0
  57. package/lib/orders/schemas.js.map +1 -0
  58. package/lib/orders/types.d.ts +99 -0
  59. package/lib/orders/types.js +3 -0
  60. package/lib/orders/types.js.map +1 -0
  61. package/lib/orders/utils.d.ts +23 -0
  62. package/lib/orders/utils.js +76 -0
  63. package/lib/orders/utils.js.map +1 -0
  64. package/lib/package.json +2 -1
  65. package/lib/schemas.d.ts +9 -0
  66. package/lib/schemas.js +50 -0
  67. package/lib/schemas.js.map +1 -0
  68. package/lib/sdk.d.ts +704 -0
  69. package/lib/sdk.js +3336 -0
  70. package/lib/sdk.js.map +1 -0
  71. package/lib/src/__integration_tests__/postOrder.d.ts +1 -0
  72. package/lib/src/__integration_tests__/postOrder.js +78 -0
  73. package/lib/src/__integration_tests__/postOrder.js.map +1 -0
  74. package/lib/src/__tests__/constants.d.ts +12 -0
  75. package/lib/src/__tests__/constants.js +22 -0
  76. package/lib/src/__tests__/constants.js.map +1 -0
  77. package/lib/src/api.d.ts +14 -2
  78. package/lib/src/api.js +74 -8
  79. package/lib/src/api.js.map +1 -1
  80. package/lib/src/constants.d.ts +1 -1
  81. package/lib/src/constants.js +1 -1
  82. package/lib/src/orders/types.d.ts +29 -1
  83. package/lib/src/orders/utils.d.ts +21 -1
  84. package/lib/src/orders/utils.js +34 -1
  85. package/lib/src/orders/utils.js.map +1 -1
  86. package/lib/src/sdk.d.ts +17 -3
  87. package/lib/src/sdk.js +86 -16
  88. package/lib/src/sdk.js.map +1 -1
  89. package/lib/src/types.d.ts +1 -1
  90. package/lib/typechain/contracts/ERC1155Abi.d.ts +436 -0
  91. package/lib/typechain/contracts/ERC1155Abi.js +6 -0
  92. package/lib/typechain/contracts/ERC1155Abi.js.map +1 -0
  93. package/lib/typechain/contracts/ERC721v3Abi.d.ts +76 -0
  94. package/lib/typechain/contracts/ERC721v3Abi.js +6 -0
  95. package/lib/typechain/contracts/ERC721v3Abi.js.map +1 -0
  96. package/lib/typechain/contracts/UniswapExchangeAbi.d.ts +132 -0
  97. package/lib/typechain/contracts/UniswapExchangeAbi.js +6 -0
  98. package/lib/typechain/contracts/UniswapExchangeAbi.js.map +1 -0
  99. package/lib/typechain/contracts/UniswapFactoryAbi.d.ts +37 -0
  100. package/lib/typechain/contracts/UniswapFactoryAbi.js +6 -0
  101. package/lib/typechain/contracts/UniswapFactoryAbi.js.map +1 -0
  102. package/lib/typechain/contracts/WrappedNFTAbi.d.ts +80 -0
  103. package/lib/typechain/contracts/WrappedNFTAbi.js +6 -0
  104. package/lib/typechain/contracts/WrappedNFTAbi.js.map +1 -0
  105. package/lib/typechain/contracts/WrappedNFTFactoryAbi.d.ts +57 -0
  106. package/lib/typechain/contracts/WrappedNFTFactoryAbi.js +6 -0
  107. package/lib/typechain/contracts/WrappedNFTFactoryAbi.js.map +1 -0
  108. package/lib/typechain/contracts/types.d.ts +54 -0
  109. package/lib/typechain/contracts/types.js +3 -0
  110. package/lib/typechain/contracts/types.js.map +1 -0
  111. package/lib/types.d.ts +516 -0
  112. package/lib/types.js +151 -0
  113. package/lib/types.js.map +1 -0
  114. package/lib/utils/index.d.ts +2 -0
  115. package/lib/utils/index.js +15 -0
  116. package/lib/utils/index.js.map +1 -0
  117. package/lib/utils/schema.d.ts +49 -0
  118. package/lib/utils/schema.js +238 -0
  119. package/lib/utils/schema.js.map +1 -0
  120. package/lib/utils/utils.d.ts +203 -0
  121. package/lib/utils/utils.js +1113 -0
  122. package/lib/utils/utils.js.map +1 -0
  123. package/package.json +2 -1
package/lib/sdk.d.ts ADDED
@@ -0,0 +1,704 @@
1
+ import { Seaport } from "@opensea/seaport-js";
2
+ import { BigNumber } from "bignumber.js";
3
+ import { providers } from "ethers";
4
+ import { EventSubscription } from "fbemitter";
5
+ import Web3 from "web3";
6
+ import { OpenSeaAPI } from "./api";
7
+ import { OrderV2 } from "./orders/types";
8
+ import { Asset, ComputedFees, ECSignature, EventData, EventType, FeeMethod, OpenSeaAPIConfig, OpenSeaAsset, OpenSeaFungibleToken, Order, OrderSide, PartialReadonlyContractAbi, UnhashedOrder, UnsignedOrder, WyvernAsset, WyvernSchemaName } from "./types";
9
+ import { BigNumberInput } from "./utils/utils";
10
+ export declare class OpenSeaSDK {
11
+ web3: Web3;
12
+ web3ReadOnly: Web3;
13
+ ethersProvider: providers.Web3Provider;
14
+ seaport: Seaport;
15
+ seaport_v1_4: Seaport;
16
+ logger: (arg: string) => void;
17
+ readonly api: OpenSeaAPI;
18
+ gasPriceAddition: BigNumber;
19
+ gasIncreaseFactor: number;
20
+ private _networkName;
21
+ private _wyvernProtocol;
22
+ private _wyvernProtocolReadOnly;
23
+ private _wyvernConfigOverride?;
24
+ private _emitter;
25
+ private _wrappedNFTFactoryAddress;
26
+ private _wrappedNFTLiquidationProxyAddress;
27
+ private _uniswapFactoryAddress;
28
+ /**
29
+ * Your very own seaport.
30
+ * Create a new instance of OpenSeaJS.
31
+ * @param provider Web3 Provider to use for transactions. For example:
32
+ * `const provider = new Web3.providers.HttpProvider('https://mainnet.infura.io')`
33
+ * @param apiConfig configuration options, including `networkName`
34
+ * @param logger logger, optional, a function that will be called with debugging
35
+ * information
36
+ */
37
+ constructor(provider: Web3["currentProvider"], apiConfig?: OpenSeaAPIConfig, logger?: (arg: string) => void);
38
+ /**
39
+ * Add a listener to a marketplace event
40
+ * @param event An event to listen for
41
+ * @param listener A callback that will accept an object with event data
42
+ * @param once Whether the listener should only be called once
43
+ */
44
+ addListener(event: EventType, listener: (data: EventData) => void, once?: boolean): EventSubscription;
45
+ /**
46
+ * Remove an event listener, included here for completeness.
47
+ * Simply calls `.remove()` on a subscription
48
+ * @param subscription The event subscription returned from `addListener`
49
+ */
50
+ removeListener(subscription: EventSubscription): void;
51
+ /**
52
+ * Remove all event listeners. Good idea to call this when you're unmounting
53
+ * a component that listens to events to make UI updates
54
+ * @param event Optional EventType to remove listeners for
55
+ */
56
+ removeAllListeners(event?: EventType): void;
57
+ /**
58
+ * Wraps an arbitrary group of NFTs into their corresponding WrappedNFT ERC20 tokens.
59
+ * Emits the `WrapAssets` event when the transaction is prompted.
60
+ * @param param0 __namedParameters Object
61
+ * @param assets An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.
62
+ * @param accountAddress Address of the user's wallet
63
+ */
64
+ wrapAssets({ assets, accountAddress, }: {
65
+ assets: Asset[];
66
+ accountAddress: string;
67
+ }): Promise<void>;
68
+ /**
69
+ * Unwraps an arbitrary group of NFTs from their corresponding WrappedNFT ERC20 tokens back into ERC721 tokens.
70
+ * Emits the `UnwrapAssets` event when the transaction is prompted.
71
+ * @param param0 __namedParameters Object
72
+ * @param assets An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.
73
+ * @param destinationAddresses Addresses that each resulting ERC721 token will be sent to. Must be the same length as `tokenIds`. Each address corresponds with its respective token ID in the `tokenIds` array.
74
+ * @param accountAddress Address of the user's wallet
75
+ */
76
+ unwrapAssets({ assets, destinationAddresses, accountAddress, }: {
77
+ assets: Asset[];
78
+ destinationAddresses: string[];
79
+ accountAddress: string;
80
+ }): Promise<void>;
81
+ /**
82
+ * Liquidates an arbitrary group of NFTs by atomically wrapping them into their
83
+ * corresponding WrappedNFT ERC20 tokens, and then immediately selling those
84
+ * ERC20 tokens on their corresponding Uniswap exchange.
85
+ * Emits the `LiquidateAssets` event when the transaction is prompted.
86
+ * @param param0 __namedParameters Object
87
+ * @param assets An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.
88
+ * @param accountAddress Address of the user's wallet
89
+ * @param uniswapSlippageAllowedInBasisPoints The amount of slippage that a user will tolerate in their Uniswap trade; if Uniswap cannot fulfill the order without more slippage, the whole function will revert.
90
+ */
91
+ liquidateAssets({ assets, accountAddress, uniswapSlippageAllowedInBasisPoints, }: {
92
+ assets: Asset[];
93
+ accountAddress: string;
94
+ uniswapSlippageAllowedInBasisPoints: number;
95
+ }): Promise<void>;
96
+ /**
97
+ * Purchases a bundle of WrappedNFT tokens from Uniswap and then unwraps them into ERC721 tokens.
98
+ * Emits the `PurchaseAssets` event when the transaction is prompted.
99
+ * @param param0 __namedParameters Object
100
+ * @param numTokensToBuy The number of WrappedNFT tokens to purchase and unwrap
101
+ * @param amount The estimated cost in wei for tokens (probably some ratio above the minimum amount to avoid the transaction failing due to frontrunning, minimum amount is found by calling UniswapExchange(uniswapAddress).getEthToTokenOutputPrice(numTokensToBuy.mul(10**18));
102
+ * @param contractAddress Address of the corresponding NFT core contract for these NFTs.
103
+ * @param accountAddress Address of the user's wallet
104
+ */
105
+ purchaseAssets({ numTokensToBuy, amount, contractAddress, accountAddress, }: {
106
+ numTokensToBuy: number;
107
+ amount: BigNumber;
108
+ contractAddress: string;
109
+ accountAddress: string;
110
+ }): Promise<void>;
111
+ /**
112
+ * Gets the estimated cost or payout of either buying or selling NFTs to Uniswap using either purchaseAssts() or liquidateAssets()
113
+ * @param param0 __namedParameters Object
114
+ * @param numTokens The number of WrappedNFT tokens to either purchase or sell
115
+ * @param isBuying A bool for whether the user is buying or selling
116
+ * @param contractAddress Address of the corresponding NFT core contract for these NFTs.
117
+ */
118
+ getQuoteFromUniswap({ numTokens, isBuying, contractAddress, }: {
119
+ numTokens: number;
120
+ isBuying: boolean;
121
+ contractAddress: string;
122
+ }): Promise<number>;
123
+ /**
124
+ * Wrap ETH into W-ETH.
125
+ * W-ETH is needed for placing buy orders (making offers).
126
+ * Emits the `WrapEth` event when the transaction is prompted.
127
+ * @param param0 __namedParameters Object
128
+ * @param amountInEth How much ether to wrap
129
+ * @param accountAddress Address of the user's wallet containing the ether
130
+ */
131
+ wrapEth({ amountInEth, accountAddress, }: {
132
+ amountInEth: number;
133
+ accountAddress: string;
134
+ }): Promise<void>;
135
+ /**
136
+ * Unwrap W-ETH into ETH.
137
+ * Emits the `UnwrapWeth` event when the transaction is prompted.
138
+ * @param param0 __namedParameters Object
139
+ * @param amountInEth How much W-ETH to unwrap
140
+ * @param accountAddress Address of the user's wallet containing the W-ETH
141
+ */
142
+ unwrapWeth({ amountInEth, accountAddress, }: {
143
+ amountInEth: number;
144
+ accountAddress: string;
145
+ }): Promise<void>;
146
+ private getAmountWithBasisPointsApplied;
147
+ private getFees;
148
+ private getAssetItems;
149
+ /**
150
+ * Create a buy order to make an offer on an asset.
151
+ * @param options Options for creating the buy order
152
+ * @param options.asset The asset to trade
153
+ * @param options.accountAddress Address of the maker's wallet
154
+ * @param options.startAmount Value of the offer, in units of the payment token (or wrapped ETH if no payment token address specified)
155
+ * @param options.quantity The number of assets to bid for (if fungible or semi-fungible). Defaults to 1. In units, not base units, e.g. not wei
156
+ * @param options.domain An optional domain to be hashed and included in the first four bytes of the random salt.
157
+ * @param options.salt Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.
158
+ * @param options.expirationTime Expiration time for the order, in seconds
159
+ * @param options.paymentTokenAddress Optional address for using an ERC-20 token in the order. If unspecified, defaults to WETH
160
+ */
161
+ createBuyOrder({ asset, accountAddress, startAmount, quantity, domain, salt, expirationTime, paymentTokenAddress, }: {
162
+ asset: Asset;
163
+ accountAddress: string;
164
+ startAmount: BigNumberInput;
165
+ quantity?: BigNumberInput;
166
+ domain?: string;
167
+ salt?: string;
168
+ expirationTime?: BigNumberInput;
169
+ paymentTokenAddress?: string;
170
+ }): Promise<OrderV2>;
171
+ /**
172
+ * Create a sell order to auction an asset.
173
+ * @param options Options for creating the sell order
174
+ * @param options.asset The asset to trade
175
+ * @param options.accountAddress Address of the maker's wallet
176
+ * @param options.startAmount Price of the asset at the start of the auction. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
177
+ * @param options.endAmount Optional price of the asset at the end of its expiration time. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
178
+ * @param options.quantity The number of assets to sell (if fungible or semi-fungible). Defaults to 1. In units, not base units, e.g. not wei.
179
+ * @param options.domain An optional domain to be hashed and included in the first four bytes of the random salt.
180
+ * @param options.salt Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.
181
+ * @param options.listingTime Optional time when the order will become fulfillable, in UTC seconds. Undefined means it will start now.
182
+ * @param options.expirationTime Expiration time for the order, in UTC seconds.
183
+ * @param options.paymentTokenAddress Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.
184
+ * @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.
185
+ */
186
+ createSellOrder({ asset, accountAddress, startAmount, endAmount, quantity, domain, salt, listingTime, expirationTime, paymentTokenAddress, buyerAddress, }: {
187
+ asset: Asset;
188
+ accountAddress: string;
189
+ startAmount: BigNumberInput;
190
+ endAmount?: BigNumberInput;
191
+ quantity?: BigNumberInput;
192
+ domain?: string;
193
+ salt?: string;
194
+ listingTime?: string;
195
+ expirationTime?: BigNumberInput;
196
+ paymentTokenAddress?: string;
197
+ buyerAddress?: string;
198
+ }): Promise<OrderV2>;
199
+ private fulfillPrivateOrder;
200
+ /**
201
+ * Fullfill or "take" an order for an asset, either a buy or sell order
202
+ * @param options fullfillment options
203
+ * @param options.order The order to fulfill, a.k.a. "take"
204
+ * @param options.accountAddress The taker's wallet address
205
+ * @param options.recipientAddress The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress
206
+ * @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata
207
+ * @returns Transaction hash for fulfilling the order
208
+ */
209
+ fulfillOrder({ order, accountAddress, recipientAddress, domain, }: {
210
+ order: OrderV2;
211
+ accountAddress: string;
212
+ recipientAddress?: string;
213
+ domain?: string;
214
+ }): Promise<string>;
215
+ /**
216
+ * Fullfill or "take" an order for an asset, either a buy or sell order
217
+ * @param param0 __namedParamaters Object
218
+ * @param order The order to fulfill, a.k.a. "take"
219
+ * @param accountAddress The taker's wallet address
220
+ * @param recipientAddress The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress.
221
+ * @param referrerAddress The optional address that referred the order
222
+ * @returns Transaction hash for fulfilling the order
223
+ */
224
+ fulfillOrderLegacyWyvern({ order, accountAddress, recipientAddress, referrerAddress, }: {
225
+ order: Order;
226
+ accountAddress: string;
227
+ recipientAddress?: string;
228
+ referrerAddress?: string;
229
+ }): Promise<string>;
230
+ private cancelSeaportOrders;
231
+ /**
232
+ * Cancel an order on-chain, preventing it from ever being fulfilled.
233
+ * @param param0 __namedParameters Object
234
+ * @param order The order to cancel
235
+ * @param accountAddress The order maker's wallet address
236
+ * @param domain An optional domain to be hashed and included at the end of fulfillment calldata
237
+ */
238
+ cancelOrder({ order, accountAddress, domain, }: {
239
+ order: OrderV2;
240
+ accountAddress: string;
241
+ domain?: string;
242
+ }): Promise<void>;
243
+ /**
244
+ * Cancel an order on-chain, preventing it from ever being fulfilled.
245
+ * @param param0 __namedParameters Object
246
+ * @param order The order to cancel
247
+ * @param accountAddress The order maker's wallet address
248
+ */
249
+ cancelOrderLegacyWyvern({ order, accountAddress, }: {
250
+ order: Order;
251
+ accountAddress: string;
252
+ }): Promise<void>;
253
+ /**
254
+ * Cancel all existing orders with a lower nonce on-chain, preventing them from ever being fulfilled.
255
+ * @param param0 __namedParameters Object
256
+ * @param accountAddress The order maker's wallet address
257
+ */
258
+ bulkCancelExistingOrdersLegacyWyvern({ accountAddress, }: {
259
+ accountAddress: string;
260
+ }): Promise<void>;
261
+ /**
262
+ * Approve a non-fungible token for use in trades.
263
+ * Requires an account to be initialized first.
264
+ * Called internally, but exposed for dev flexibility.
265
+ * Checks to see if already approved, first. Then tries different approval methods from best to worst.
266
+ * @param param0 __namedParameters Object
267
+ * @param tokenId Token id to approve, but only used if approve-all isn't
268
+ * supported by the token contract
269
+ * @param tokenAddress The contract address of the token being approved
270
+ * @param accountAddress The user's wallet address
271
+ * @param proxyAddress Address of the user's proxy contract. If not provided,
272
+ * will attempt to fetch it from Wyvern.
273
+ * @param tokenAbi ABI of the token's contract. Defaults to a flexible ERC-721
274
+ * contract.
275
+ * @param skipApproveAllIfTokenAddressIn an optional list of token addresses that, if a token is approve-all type, will skip approval
276
+ * @param schemaName The Wyvern schema name corresponding to the asset type
277
+ * @returns Transaction hash if a new transaction was created, otherwise null
278
+ */
279
+ approveSemiOrNonFungibleToken({ tokenId, tokenAddress, accountAddress, proxyAddress, tokenAbi, skipApproveAllIfTokenAddressIn, schemaName, }: {
280
+ tokenId: string;
281
+ tokenAddress: string;
282
+ accountAddress: string;
283
+ proxyAddress?: string;
284
+ tokenAbi?: PartialReadonlyContractAbi;
285
+ skipApproveAllIfTokenAddressIn?: Set<string>;
286
+ schemaName?: WyvernSchemaName;
287
+ }): Promise<string | null>;
288
+ /**
289
+ * Approve a fungible token (e.g. W-ETH) for use in trades.
290
+ * Called internally, but exposed for dev flexibility.
291
+ * Checks to see if the minimum amount is already approved, first.
292
+ * @param param0 __namedParameters Object
293
+ * @param accountAddress The user's wallet address
294
+ * @param tokenAddress The contract address of the token being approved
295
+ * @param proxyAddress The user's proxy address. If unspecified, uses the Wyvern token transfer proxy address.
296
+ * @param minimumAmount The minimum amount needed to skip a transaction. Defaults to the max-integer.
297
+ * @returns Transaction hash if a new transaction occurred, otherwise null
298
+ */
299
+ approveFungibleToken({ accountAddress, tokenAddress, proxyAddress, minimumAmount, }: {
300
+ accountAddress: string;
301
+ tokenAddress: string;
302
+ proxyAddress?: string;
303
+ minimumAmount?: BigNumber;
304
+ }): Promise<string | null>;
305
+ /**
306
+ * Un-approve a fungible token (e.g. W-ETH) for use in trades.
307
+ * Called internally, but exposed for dev flexibility.
308
+ * Useful for old ERC20s that require a 0 approval count before
309
+ * changing the count
310
+ * @param param0 __namedParameters Object
311
+ * @param accountAddress The user's wallet address
312
+ * @param tokenAddress The contract address of the token being approved
313
+ * @param proxyAddress The user's proxy address. If unspecified, uses the Wyvern token transfer proxy address.
314
+ * @returns Transaction hash
315
+ */
316
+ unapproveFungibleToken({ accountAddress, tokenAddress, proxyAddress, }: {
317
+ accountAddress: string;
318
+ tokenAddress: string;
319
+ proxyAddress?: string;
320
+ }): Promise<string>;
321
+ /**
322
+ * Register a domain on the Domain Registry contract.
323
+ * @param domain The string domain to be hashed and registered on the Registry.
324
+ * @returns Transaction hash
325
+ */
326
+ setDomain(domain: string): Promise<string>;
327
+ /**
328
+ * Get the domain for a specific tag at a given index.
329
+ * @param tag The tag to look up.
330
+ * @param index The index of the domain to return.
331
+ * @returns Domain
332
+ */
333
+ getDomain(tag: string, index: number): Promise<string>;
334
+ /**
335
+ * Get the full array of domains for a specific tag.
336
+ * @param tag The tag to look up.
337
+ * @returns Array of domains
338
+ */
339
+ getDomains(tag: string): Promise<string[]>;
340
+ /**
341
+ * Get the number of registered domains for a specific tag.
342
+ * @param tag The tag to look up.
343
+ * @returns Number of registered domains for input tag.
344
+ */
345
+ getNumberOfDomains(tag: string): Promise<BigNumber>;
346
+ /**
347
+ * Gets the current price for the order.
348
+ */
349
+ getCurrentPrice({ order, }: {
350
+ order: OrderV2;
351
+ }): Promise<BigNumber>;
352
+ /**
353
+ * Gets the price for the order using the contract
354
+ * @param order The order to calculate the price for
355
+ */
356
+ getCurrentPriceLegacyWyvern(order: Order): Promise<BigNumber>;
357
+ /**
358
+ * Returns whether an order is fulfillable.
359
+ * An order may not be fulfillable if a target item's transfer function
360
+ * is locked for some reason, e.g. an item is being rented within a game
361
+ * or trading has been locked for an item type.
362
+ * @param param0 __namedParameters Object
363
+ * @param order Order to check
364
+ * @param accountAddress The account address that will be fulfilling the order
365
+ * @param recipientAddress The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress.
366
+ * @param referrerAddress The optional address that referred the order
367
+ */
368
+ isOrderFulfillable({ order, accountAddress, }: {
369
+ order: OrderV2;
370
+ accountAddress: string;
371
+ }): Promise<boolean>;
372
+ /**
373
+ * Returns whether an order is fulfillable.
374
+ * An order may not be fulfillable if a target item's transfer function
375
+ * is locked for some reason, e.g. an item is being rented within a game
376
+ * or trading has been locked for an item type.
377
+ * @param param0 __namedParameters Object
378
+ * @param order Order to check
379
+ * @param accountAddress The account address that will be fulfilling the order
380
+ * @param recipientAddress The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress.
381
+ * @param referrerAddress The optional address that referred the order
382
+ */
383
+ isOrderFulfillableLegacyWyvern({ order, accountAddress, recipientAddress, referrerAddress, }: {
384
+ order: Order;
385
+ accountAddress: string;
386
+ recipientAddress?: string;
387
+ referrerAddress?: string;
388
+ }): Promise<boolean>;
389
+ /**
390
+ * Returns whether an asset is transferrable.
391
+ * An asset may not be transferrable if its transfer function
392
+ * is locked for some reason, e.g. an item is being rented within a game
393
+ * or trading has been locked for an item type.
394
+ * @param param0 __namedParameters Object
395
+ * @param tokenId DEPRECATED: Token ID. Use `asset` instead.
396
+ * @param tokenAddress DEPRECATED: Address of the token's contract. Use `asset` instead.
397
+ * @param asset The asset to trade
398
+ * @param fromAddress The account address that currently owns the asset
399
+ * @param toAddress The account address that will be acquiring the asset
400
+ * @param quantity The amount of the asset to transfer, if it's fungible (optional). In units (not base units), e.g. not wei.
401
+ * @param useProxy Use the `fromAddress`'s proxy contract only if the `fromAddress` has already approved the asset for sale. Required if checking an ERC-721 v1 asset (like CryptoKitties) that doesn't check if the transferFrom caller is the owner of the asset (only allowing it if it's an approved address).
402
+ * @param retries How many times to retry if false
403
+ */
404
+ isAssetTransferrable({ asset, fromAddress, toAddress, quantity, useProxy, }: {
405
+ asset: Asset;
406
+ fromAddress: string;
407
+ toAddress: string;
408
+ quantity?: number | BigNumber;
409
+ useProxy?: boolean;
410
+ }, retries?: number): Promise<boolean>;
411
+ /**
412
+ * Transfer a fungible or non-fungible asset to another address
413
+ * @param param0 __namedParamaters Object
414
+ * @param fromAddress The owner's wallet address
415
+ * @param toAddress The recipient's wallet address
416
+ * @param asset The fungible or non-fungible asset to transfer
417
+ * @param quantity The amount of the asset to transfer, if it's fungible (optional). In units (not base units), e.g. not wei.
418
+ * @returns Transaction hash
419
+ */
420
+ transfer({ fromAddress, toAddress, asset, quantity, }: {
421
+ fromAddress: string;
422
+ toAddress: string;
423
+ asset: Asset;
424
+ quantity?: number | BigNumber;
425
+ }): Promise<string>;
426
+ /**
427
+ * Transfer one or more assets to another address.
428
+ * ERC-721 and ERC-1155 assets are supported
429
+ * @param param0 __namedParamaters Object
430
+ * @param assets An array of objects with the tokenId and tokenAddress of each of the assets to transfer.
431
+ * @param fromAddress The owner's wallet address
432
+ * @param toAddress The recipient's wallet address
433
+ * @param schemaName The Wyvern schema name corresponding to the asset type, if not in each Asset definition
434
+ * @returns Transaction hash
435
+ */
436
+ transferAll({ assets, fromAddress, toAddress, schemaName, }: {
437
+ assets: Asset[];
438
+ fromAddress: string;
439
+ toAddress: string;
440
+ schemaName?: WyvernSchemaName;
441
+ }): Promise<string>;
442
+ /**
443
+ * Get known payment tokens (ERC-20) that match your filters.
444
+ * @param param0 __namedParameters Object
445
+ * @param symbol Filter by the ERC-20 symbol for the token,
446
+ * e.g. "DAI" for Dai stablecoin
447
+ * @param address Filter by the ERC-20 contract address for the token,
448
+ * e.g. "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359" for Dai
449
+ * @param name Filter by the name of the ERC-20 contract.
450
+ * Not guaranteed to exist or be unique for each token type.
451
+ * e.g. '' for Dai and 'Decentraland' for MANA
452
+ * FUTURE: officiallySupported: Filter for tokens that are
453
+ * officially supported and shown on opensea.io
454
+ */
455
+ getFungibleTokens({ symbol, address, name, }?: {
456
+ symbol?: string;
457
+ address?: string;
458
+ name?: string;
459
+ }): Promise<OpenSeaFungibleToken[]>;
460
+ /**
461
+ * Get an account's balance of any Asset.
462
+ * @param param0 __namedParameters Object
463
+ * @param accountAddress Account address to check
464
+ * @param asset The Asset to check balance for
465
+ * @param retries How many times to retry if balance is 0
466
+ */
467
+ getAssetBalance({ accountAddress, asset }: {
468
+ accountAddress: string;
469
+ asset: Asset;
470
+ }, retries?: number): Promise<BigNumber>;
471
+ /**
472
+ * Get the balance of a fungible token.
473
+ * Convenience method for getAssetBalance for fungibles
474
+ * @param param0 __namedParameters Object
475
+ * @param accountAddress Account address to check
476
+ * @param tokenAddress The address of the token to check balance for
477
+ * @param schemaName Optional schema name for the fungible token
478
+ * @param retries Number of times to retry if balance is undefined
479
+ */
480
+ getTokenBalance({ accountAddress, tokenAddress, schemaName, }: {
481
+ accountAddress: string;
482
+ tokenAddress: string;
483
+ schemaName?: WyvernSchemaName;
484
+ }, retries?: number): Promise<BigNumber>;
485
+ /**
486
+ * Compute the fees for an order
487
+ * @param param0 __namedParameters
488
+ * @param asset Asset to use for fees. May be blank ONLY for multi-collection bundles.
489
+ * @param side The side of the order (buy or sell)
490
+ * @param accountAddress The account to check fees for (useful if fees differ by account, like transfer fees)
491
+ */
492
+ computeFees({ asset, }: {
493
+ asset?: OpenSeaAsset;
494
+ side: OrderSide;
495
+ }): Promise<ComputedFees>;
496
+ /**
497
+ * DEPRECATED: ERC-1559
498
+ * https://eips.ethereum.org/EIPS/eip-1559
499
+ * Compute the gas price for sending a txn, in wei
500
+ * Will be slightly above the mean to make it faster
501
+ */
502
+ _computeGasPrice(): Promise<BigNumber>;
503
+ /**
504
+ * Compute the gas amount for sending a txn
505
+ * Will be slightly above the result of estimateGas to make it more reliable
506
+ * @param estimation The result of estimateGas for a transaction
507
+ */
508
+ _correctGasAmount(estimation: number): number;
509
+ /**
510
+ * Estimate the gas needed to match two orders. Returns undefined if tx errors
511
+ * @param param0 __namedParamaters Object
512
+ * @param buy The buy order to match
513
+ * @param sell The sell order to match
514
+ * @param accountAddress The taker's wallet address
515
+ * @param metadata Metadata bytes32 to send with the match
516
+ * @param retries Number of times to retry if false
517
+ */
518
+ _estimateGasForMatch({ buy, sell, accountAddress, metadata, }: {
519
+ buy: Order;
520
+ sell: Order;
521
+ accountAddress: string;
522
+ metadata?: string;
523
+ }, retries?: number): Promise<number | undefined>;
524
+ /**
525
+ * Get the proxy address for a user's wallet.
526
+ * Internal method exposed for dev flexibility.
527
+ * @param accountAddress The user's wallet address
528
+ * @param retries Optional number of retries to do
529
+ * @param wyvernProtocol optional wyvern protocol override
530
+ */
531
+ _getProxy(accountAddress: string, retries?: number): Promise<string | null>;
532
+ /**
533
+ * Initialize the proxy for a user's wallet.
534
+ * Proxies are used to make trades on behalf of the order's maker so that
535
+ * trades can happen when the maker isn't online.
536
+ * Internal method exposed for dev flexibility.
537
+ * @param accountAddress The user's wallet address
538
+ * @param wyvernProtocol optional wyvern protocol override
539
+ */
540
+ _initializeProxy(accountAddress: string): Promise<string>;
541
+ /**
542
+ * For a fungible token to use in trades (like W-ETH), get the amount
543
+ * approved for use by the Wyvern transfer proxy.
544
+ * Internal method exposed for dev flexibility.
545
+ * @param param0 __namedParameters Object
546
+ * @param accountAddress Address for the user's wallet
547
+ * @param tokenAddress Address for the token's contract
548
+ * @param proxyAddress User's proxy address. If undefined, uses the token transfer proxy address
549
+ */
550
+ _getApprovedTokenCount({ accountAddress, tokenAddress, proxyAddress, }: {
551
+ accountAddress: string;
552
+ tokenAddress?: string;
553
+ proxyAddress?: string;
554
+ }): Promise<BigNumber>;
555
+ _makeMatchingOrder({ order, accountAddress, recipientAddress, }: {
556
+ order: UnsignedOrder;
557
+ accountAddress: string;
558
+ recipientAddress: string;
559
+ }): UnsignedOrder;
560
+ /**
561
+ * Validate against Wyvern that a buy and sell order can match
562
+ * @param param0 __namedParameters Object
563
+ * @param buy The buy order to validate
564
+ * @param sell The sell order to validate
565
+ * @param accountAddress Address for the user's wallet
566
+ * @param shouldValidateBuy Whether to validate the buy order individually.
567
+ * @param shouldValidateSell Whether to validate the sell order individually.
568
+ * @param retries How many times to retry if validation fails
569
+ */
570
+ _validateMatch({ buy, sell, accountAddress, shouldValidateBuy, shouldValidateSell, }: {
571
+ buy: Order;
572
+ sell: Order;
573
+ accountAddress: string;
574
+ shouldValidateBuy?: boolean;
575
+ shouldValidateSell?: boolean;
576
+ }, retries?: number): Promise<boolean>;
577
+ _createEmailWhitelistEntry({ order, buyerEmail, }: {
578
+ order: UnhashedOrder;
579
+ buyerEmail: string;
580
+ }): Promise<void>;
581
+ _sellOrderValidationAndApprovals({ order, accountAddress, }: {
582
+ order: UnhashedOrder;
583
+ accountAddress: string;
584
+ }): Promise<void>;
585
+ /**
586
+ * Instead of signing an off-chain order, you can approve an order
587
+ * with on on-chain transaction using this method
588
+ * @param order Order to approve
589
+ * @param domain An optional domain to be hashed and included at the end of fulfillment calldata
590
+ * @returns Transaction hash of the approval transaction
591
+ */
592
+ approveOrder(order: OrderV2, domain?: string): Promise<string>;
593
+ /**
594
+ * Instead of signing an off-chain order, you can approve an order
595
+ * with on on-chain transaction using this method
596
+ * @param order Order to approve
597
+ * @returns Transaction hash of the approval transaction
598
+ */
599
+ approveOrderLegacyWyvern(order: UnsignedOrder): Promise<string>;
600
+ _validateOrder(order: Order): Promise<boolean>;
601
+ _approveAll({ schemaNames, wyAssets, accountAddress, proxyAddress, }: {
602
+ schemaNames: WyvernSchemaName[];
603
+ wyAssets: WyvernAsset[];
604
+ accountAddress: string;
605
+ proxyAddress?: string;
606
+ }): Promise<(string | null)[]>;
607
+ _buyOrderValidationAndApprovals({ order, counterOrder, accountAddress, }: {
608
+ order: UnhashedOrder;
609
+ counterOrder?: Order;
610
+ accountAddress: string;
611
+ }): Promise<void>;
612
+ /**
613
+ * Check if an account, or its proxy, owns an asset on-chain
614
+ * @param accountAddress Account address for the wallet
615
+ * @param proxyAddress Proxy address for the account
616
+ * @param wyAsset asset to check. If fungible, the `quantity` attribute will be the minimum amount to own
617
+ * @param schemaName WyvernSchemaName for the asset
618
+ */
619
+ _ownsAssetOnChain({ accountAddress, proxyAddress, wyAsset, schemaName, }: {
620
+ accountAddress: string;
621
+ proxyAddress?: string | null;
622
+ wyAsset: WyvernAsset;
623
+ schemaName: WyvernSchemaName;
624
+ }): Promise<boolean>;
625
+ _getBuyFeeParameters(totalBuyerFeeBasisPoints: number, totalSellerFeeBasisPoints: number, sellOrder?: UnhashedOrder): {
626
+ makerRelayerFee: BigNumber;
627
+ takerRelayerFee: BigNumber;
628
+ makerProtocolFee: BigNumber;
629
+ takerProtocolFee: BigNumber;
630
+ makerReferrerFee: BigNumber;
631
+ feeRecipient: string;
632
+ feeMethod: FeeMethod;
633
+ };
634
+ /**
635
+ * Validate fee parameters
636
+ * @param totalBuyerFeeBasisPoints Total buyer fees
637
+ * @param totalSellerFeeBasisPoints Total seller fees
638
+ */
639
+ private _validateFees;
640
+ /**
641
+ * Get the listing and expiration time parameters for a new order
642
+ * @param expirationTimestamp Timestamp to expire the order (in seconds), or 0 for non-expiring
643
+ * @param listingTimestamp Timestamp to start the order (in seconds), or undefined to start it now
644
+ * @param waitingForBestCounterOrder Whether this order should be hidden until the best match is found
645
+ */
646
+ private _getTimeParameters;
647
+ /**
648
+ * Compute the `basePrice` and `extra` parameters to be used to price an order.
649
+ * Also validates the expiration time and auction type.
650
+ * @param tokenAddress Address of the ERC-20 token to use for trading.
651
+ * Use the null address for ETH
652
+ * @param expirationTime When the auction expires, or 0 if never.
653
+ * @param startAmount The base value for the order, in the token's main units (e.g. ETH instead of wei)
654
+ * @param endAmount The end value for the order, in the token's main units (e.g. ETH instead of wei). If unspecified, the order's `extra` attribute will be 0
655
+ */
656
+ private _getPriceParameters;
657
+ private _getMetadata;
658
+ private _atomicMatch;
659
+ private _getRequiredAmountForTakingSellOrder;
660
+ /**
661
+ * Gets the current order nonce for an account
662
+ * @param accountAddress account to check the nonce for
663
+ * @returns nonce
664
+ */
665
+ getNonce(accountAddress: string): Promise<BigNumber>;
666
+ /**
667
+ * Generate the signature for authorizing an order
668
+ * @param order Unsigned wyvern order
669
+ * @returns order signature in the form of v, r, s, also an optional nonce
670
+ */
671
+ authorizeOrder(order: UnsignedOrder): Promise<(ECSignature & {
672
+ nonce?: number;
673
+ }) | null>;
674
+ private _getSchemaName;
675
+ private _getSchema;
676
+ private _dispatch;
677
+ /**
678
+ * Get the clients to use for a read call
679
+ * @param retries current retry value
680
+ * @param wyvernProtocol optional wyvern protocol to use, has default
681
+ * @param wyvernProtocol optional readonly wyvern protocol to use, has default
682
+ */
683
+ private _getClientsForRead;
684
+ private _confirmTransaction;
685
+ private _pollCallbackForConfirmation;
686
+ /**
687
+ * Returns whether or not an authenticated proxy is revoked for a specific account address
688
+ * @param accountAddress
689
+ * @returns
690
+ */
691
+ isAuthenticatedProxyRevoked(accountAddress: string): Promise<boolean>;
692
+ /**
693
+ * Revokes an authenticated proxy's access i.e. for freezing listings
694
+ * @param accountAddress
695
+ * @returns transaction hash
696
+ */
697
+ revokeAuthenticatedProxyAccess(accountAddress: string): Promise<string>;
698
+ /**
699
+ * Unrevokes an authenticated proxy's access i.e. for unfreezing listings
700
+ * @param accountAddress
701
+ * @returns transaction hash
702
+ */
703
+ unrevokeAuthenticatedProxyAccess(accountAddress: string): Promise<string>;
704
+ }