opensea-js 2.0.0-beta.0 → 2.0.0-beta.4
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/lib/__tests__/seaport/orders.js +199 -24
- package/lib/__tests__/seaport/orders.js.map +1 -1
- package/lib/api.js +1 -0
- package/lib/api.js.map +1 -1
- package/lib/constants.d.ts +0 -2
- package/lib/constants.js +1 -3
- package/lib/constants.js.map +1 -1
- package/lib/seaport.d.ts +10 -4
- package/lib/seaport.js +98 -90
- package/lib/seaport.js.map +1 -1
- package/lib/types.d.ts +4 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/schema.d.ts +1 -4
- package/lib/utils/schema.js +3 -5
- package/lib/utils/schema.js.map +1 -1
- package/lib/utils/utils.d.ts +11 -3
- package/lib/utils/utils.js +12 -4
- package/lib/utils/utils.js.map +1 -1
- package/package.json +3 -3
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;AAAA,uCAA2C;AAE9B,QAAA,2BAA2B,GAAG,IAAI,CAAC;AACnC,QAAA,YAAY,GAAG,0BAAc,CAAC,YAAY,CAAC;AAC3C,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAC1D,QAAA,qBAAqB,GAChC,4CAA4C,CAAC;AAClC,QAAA,mBAAmB,GAAG,KAAK,CAAC;AAC5B,QAAA,YAAY,GAAG,0BAAc,CAAC,YAAY,CAAC;AAC3C,QAAA,kBAAkB,GAAG,4CAA4C,CAAC;AAClE,QAAA,YAAY,GAAG,4CAA4C,CAAC;AAC5D,QAAA,aAAa,GAAG,4CAA4C,CAAC;AAC7D,QAAA,oBAAoB,GAC/B,4CAA4C,CAAC;AAClC,QAAA,UAAU,GAAG,4CAA4C,CAAC;AAC1D,QAAA,kBAAkB,GAAG,4CAA4C,CAAC;AAClE,QAAA,mCAAmC,GAC9C,4CAA4C,CAA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AAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;KACnC;CACF,CAAC;AAEW,QAAA,0BAA0B,GAAG,0BAA0B,CAAC;AACxD,QAAA,6BAA6B,GAAG,KAAK,CAAC;AACtC,QAAA,wBAAwB,GACnC,4CAA4C,CAAC;AAClC,QAAA,wBAAwB,GACnC,4CAA4C,CAAC"}
|
package/lib/seaport.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
2
|
import { EventSubscription } from "fbemitter";
|
|
3
3
|
import Web3 from "web3";
|
|
4
|
+
import { WyvernProtocol } from "wyvern-js";
|
|
4
5
|
import { OpenSeaAPI } from "./api";
|
|
5
6
|
import { Asset, ComputedFees, ECSignature, EventData, EventType, FeeMethod, OpenSeaAPIConfig, OpenSeaAsset, OpenSeaFungibleToken, Order, OrderSide, PartialReadonlyContractAbi, UnhashedOrder, UnsignedOrder, WyvernAsset, WyvernSchemaName } from "./types";
|
|
6
7
|
export declare class OpenSeaPort {
|
|
@@ -15,6 +16,7 @@ export declare class OpenSeaPort {
|
|
|
15
16
|
private _wyvernProtocolReadOnly;
|
|
16
17
|
private _wyvern2_2Protocol;
|
|
17
18
|
private _wyvern2_2ProtocolReadOnly;
|
|
19
|
+
private _wyvernConfigOverride?;
|
|
18
20
|
private _wyvernExchangeForOrderCreationPromise;
|
|
19
21
|
private _emitter;
|
|
20
22
|
private _wrappedNFTFactoryAddress;
|
|
@@ -583,16 +585,18 @@ export declare class OpenSeaPort {
|
|
|
583
585
|
* Internal method exposed for dev flexibility.
|
|
584
586
|
* @param accountAddress The user's wallet address
|
|
585
587
|
* @param retries Optional number of retries to do
|
|
588
|
+
* @param wyvernProtocol optional wyvern protocol override
|
|
586
589
|
*/
|
|
587
|
-
_getProxy(accountAddress: string, retries?: number): Promise<string | null>;
|
|
590
|
+
_getProxy(accountAddress: string, retries?: number, wyvernProtocol?: WyvernProtocol): Promise<string | null>;
|
|
588
591
|
/**
|
|
589
592
|
* Initialize the proxy for a user's wallet.
|
|
590
593
|
* Proxies are used to make trades on behalf of the order's maker so that
|
|
591
594
|
* trades can happen when the maker isn't online.
|
|
592
595
|
* Internal method exposed for dev flexibility.
|
|
593
596
|
* @param accountAddress The user's wallet address
|
|
597
|
+
* @param wyvernProtocol optional wyvern protocol override
|
|
594
598
|
*/
|
|
595
|
-
_initializeProxy(accountAddress: string): Promise<string>;
|
|
599
|
+
_initializeProxy(accountAddress: string, wyvernProtocol?: WyvernProtocol): Promise<string>;
|
|
596
600
|
/**
|
|
597
601
|
* For a fungible token to use in trades (like W-ETH), get the amount
|
|
598
602
|
* approved for use by the Wyvern transfer proxy.
|
|
@@ -709,13 +713,14 @@ export declare class OpenSeaPort {
|
|
|
709
713
|
* @param order Order to approve
|
|
710
714
|
* @returns Transaction hash of the approval transaction
|
|
711
715
|
*/
|
|
712
|
-
|
|
716
|
+
approveOrder(order: UnsignedOrder): Promise<string>;
|
|
713
717
|
_validateOrder(order: Order): Promise<boolean>;
|
|
714
|
-
_approveAll({ schemaNames, wyAssets, accountAddress, proxyAddress, }: {
|
|
718
|
+
_approveAll({ schemaNames, wyAssets, accountAddress, proxyAddress, wyvernProtocol, }: {
|
|
715
719
|
schemaNames: WyvernSchemaName[];
|
|
716
720
|
wyAssets: WyvernAsset[];
|
|
717
721
|
accountAddress: string;
|
|
718
722
|
proxyAddress?: string;
|
|
723
|
+
wyvernProtocol?: WyvernProtocol;
|
|
719
724
|
}): Promise<(string | null)[]>;
|
|
720
725
|
_buyOrderValidationAndApprovals({ order, counterOrder, accountAddress, }: {
|
|
721
726
|
order: UnhashedOrder;
|
|
@@ -801,6 +806,7 @@ export declare class OpenSeaPort {
|
|
|
801
806
|
private _confirmTransaction;
|
|
802
807
|
private _pollCallbackForConfirmation;
|
|
803
808
|
private _getWyvernProtocolForOrder;
|
|
809
|
+
private _getWyvernTokenTransferProxyAddressForOrder;
|
|
804
810
|
/**
|
|
805
811
|
* Returns whether or not an authenticated proxy is revoked for a specific account address
|
|
806
812
|
* @param accountAddress
|
package/lib/seaport.js
CHANGED
|
@@ -105,7 +105,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
105
105
|
*/
|
|
106
106
|
function OpenSeaPort(provider, apiConfig, logger) {
|
|
107
107
|
if (apiConfig === void 0) { apiConfig = {}; }
|
|
108
|
-
var _b;
|
|
108
|
+
var _b, _c;
|
|
109
109
|
// Extra gwei to add to the mean gas price when making transactions
|
|
110
110
|
this.gasPriceAddition = new bignumber_js_1.BigNumber(3);
|
|
111
111
|
// Multiply gas estimate by this factor when making transactions
|
|
@@ -113,6 +113,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
113
113
|
// API config
|
|
114
114
|
apiConfig.networkName = apiConfig.networkName || types_1.Network.Main;
|
|
115
115
|
this.api = new api_1.OpenSeaAPI(apiConfig);
|
|
116
|
+
this._wyvernConfigOverride = apiConfig.wyvernConfig;
|
|
116
117
|
this._networkName = apiConfig.networkName;
|
|
117
118
|
var readonlyProvider = new web3_1.default.providers.HttpProvider("".concat(this.api.apiBaseUrl, "/").concat(constants_1.RPC_URL_PATH));
|
|
118
119
|
var useReadOnlyProvider = (_b = apiConfig.useReadOnlyProvider) !== null && _b !== void 0 ? _b : true;
|
|
@@ -124,20 +125,14 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
124
125
|
// WyvernJS config
|
|
125
126
|
this._wyvernProtocol = new wyvern_js_1.WyvernProtocol(provider, __assign({ network: this._networkName }, apiConfig.wyvernConfig));
|
|
126
127
|
// Wyvern2.2JS config
|
|
127
|
-
this._wyvern2_2Protocol = new wyvern_js_1.WyvernProtocol(provider, {
|
|
128
|
-
network: this._networkName,
|
|
129
|
-
wyvernExchangeContractAddress: utils_1.wyvern2_2AddressByNetwork[this._networkName],
|
|
130
|
-
});
|
|
128
|
+
this._wyvern2_2Protocol = new wyvern_js_1.WyvernProtocol(provider, __assign({ network: this._networkName }, utils_1.wyvern2_2ConfigByNetwork[this._networkName]));
|
|
131
129
|
// WyvernJS config for readonly (optimization for infura calls)
|
|
132
130
|
this._wyvernProtocolReadOnly = useReadOnlyProvider
|
|
133
131
|
? new wyvern_js_1.WyvernProtocol(readonlyProvider, __assign({ network: this._networkName }, apiConfig.wyvernConfig))
|
|
134
132
|
: this._wyvernProtocol;
|
|
135
133
|
// Wyvern2.2 JS config for readonly (optimization for infura calls)
|
|
136
134
|
this._wyvern2_2ProtocolReadOnly = useReadOnlyProvider
|
|
137
|
-
? new wyvern_js_1.WyvernProtocol(readonlyProvider, {
|
|
138
|
-
network: this._networkName,
|
|
139
|
-
wyvernExchangeContractAddress: utils_1.wyvern2_2AddressByNetwork[this._networkName],
|
|
140
|
-
})
|
|
135
|
+
? new wyvern_js_1.WyvernProtocol(readonlyProvider, __assign({ network: this._networkName }, utils_1.wyvern2_2ConfigByNetwork[this._networkName]))
|
|
141
136
|
: this._wyvern2_2Protocol;
|
|
142
137
|
// WrappedNFTLiquidationProxy Config
|
|
143
138
|
this._wrappedNFTFactoryAddress =
|
|
@@ -156,8 +151,9 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
156
151
|
this._emitter = new fbemitter_1.EventEmitter();
|
|
157
152
|
// Debugging: default to nothing
|
|
158
153
|
this.logger = logger || (function (arg) { return arg; });
|
|
159
|
-
this._wyvernExchangeForOrderCreationPromise =
|
|
160
|
-
|
|
154
|
+
this._wyvernExchangeForOrderCreationPromise = ((_c = apiConfig.wyvernConfig) === null || _c === void 0 ? void 0 : _c.wyvernExchangeContractAddress)
|
|
155
|
+
? Promise.resolve(apiConfig.wyvernConfig.wyvernExchangeContractAddress)
|
|
156
|
+
: this.api.getOrderCreateWyvernExchangeAddress();
|
|
161
157
|
}
|
|
162
158
|
/**
|
|
163
159
|
* Add a listener to a marketplace event
|
|
@@ -2048,14 +2044,16 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2048
2044
|
* Internal method exposed for dev flexibility.
|
|
2049
2045
|
* @param accountAddress The user's wallet address
|
|
2050
2046
|
* @param retries Optional number of retries to do
|
|
2047
|
+
* @param wyvernProtocol optional wyvern protocol override
|
|
2051
2048
|
*/
|
|
2052
|
-
OpenSeaPort.prototype._getProxy = function (accountAddress, retries) {
|
|
2049
|
+
OpenSeaPort.prototype._getProxy = function (accountAddress, retries, wyvernProtocol) {
|
|
2053
2050
|
if (retries === void 0) { retries = 0; }
|
|
2051
|
+
if (wyvernProtocol === void 0) { wyvernProtocol = this._wyvernProtocolReadOnly; }
|
|
2054
2052
|
return __awaiter(this, void 0, void 0, function () {
|
|
2055
2053
|
var proxyAddress;
|
|
2056
2054
|
return __generator(this, function (_b) {
|
|
2057
2055
|
switch (_b.label) {
|
|
2058
|
-
case 0: return [4 /*yield*/,
|
|
2056
|
+
case 0: return [4 /*yield*/, wyvernProtocol.wyvernProxyRegistry.proxies.callAsync(accountAddress)];
|
|
2059
2057
|
case 1:
|
|
2060
2058
|
proxyAddress = _b.sent();
|
|
2061
2059
|
if (proxyAddress == "0x") {
|
|
@@ -2082,8 +2080,10 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2082
2080
|
* trades can happen when the maker isn't online.
|
|
2083
2081
|
* Internal method exposed for dev flexibility.
|
|
2084
2082
|
* @param accountAddress The user's wallet address
|
|
2083
|
+
* @param wyvernProtocol optional wyvern protocol override
|
|
2085
2084
|
*/
|
|
2086
|
-
OpenSeaPort.prototype._initializeProxy = function (accountAddress) {
|
|
2085
|
+
OpenSeaPort.prototype._initializeProxy = function (accountAddress, wyvernProtocol) {
|
|
2086
|
+
if (wyvernProtocol === void 0) { wyvernProtocol = this._wyvernProtocol; }
|
|
2087
2087
|
return __awaiter(this, void 0, void 0, function () {
|
|
2088
2088
|
var txnData, gasEstimate, transactionHash, proxyAddress;
|
|
2089
2089
|
var _this = this;
|
|
@@ -2093,17 +2093,17 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2093
2093
|
this._dispatch(types_1.EventType.InitializeAccount, { accountAddress: accountAddress });
|
|
2094
2094
|
this.logger("Initializing proxy for account: ".concat(accountAddress));
|
|
2095
2095
|
txnData = { from: accountAddress };
|
|
2096
|
-
return [4 /*yield*/,
|
|
2096
|
+
return [4 /*yield*/, wyvernProtocol.wyvernProxyRegistry.registerProxy.estimateGasAsync(txnData)];
|
|
2097
2097
|
case 1:
|
|
2098
2098
|
gasEstimate = _b.sent();
|
|
2099
|
-
return [4 /*yield*/,
|
|
2099
|
+
return [4 /*yield*/, wyvernProtocol.wyvernProxyRegistry.registerProxy.sendTransactionAsync(__assign(__assign({}, txnData), { gas: this._correctGasAmount(gasEstimate) }))];
|
|
2100
2100
|
case 2:
|
|
2101
2101
|
transactionHash = _b.sent();
|
|
2102
2102
|
return [4 /*yield*/, this._confirmTransaction(transactionHash, types_1.EventType.InitializeAccount, "Initializing proxy for account", function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2103
2103
|
var polledProxy;
|
|
2104
2104
|
return __generator(this, function (_b) {
|
|
2105
2105
|
switch (_b.label) {
|
|
2106
|
-
case 0: return [4 /*yield*/, this._getProxy(accountAddress)];
|
|
2106
|
+
case 0: return [4 /*yield*/, this._getProxy(accountAddress, 0, wyvernProtocol)];
|
|
2107
2107
|
case 1:
|
|
2108
2108
|
polledProxy = _b.sent();
|
|
2109
2109
|
return [2 /*return*/, !!polledProxy];
|
|
@@ -2112,7 +2112,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2112
2112
|
}); })];
|
|
2113
2113
|
case 3:
|
|
2114
2114
|
_b.sent();
|
|
2115
|
-
return [4 /*yield*/, this._getProxy(accountAddress, 10)];
|
|
2115
|
+
return [4 /*yield*/, this._getProxy(accountAddress, 10, wyvernProtocol)];
|
|
2116
2116
|
case 4:
|
|
2117
2117
|
proxyAddress = _b.sent();
|
|
2118
2118
|
if (!proxyAddress) {
|
|
@@ -2183,7 +2183,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2183
2183
|
case 2:
|
|
2184
2184
|
_e = _k.sent(), totalBuyerFeeBasisPoints = _e.totalBuyerFeeBasisPoints, totalSellerFeeBasisPoints = _e.totalSellerFeeBasisPoints;
|
|
2185
2185
|
_f = this._getBuyFeeParameters(totalBuyerFeeBasisPoints, totalSellerFeeBasisPoints, sellOrder), makerRelayerFee = _f.makerRelayerFee, takerRelayerFee = _f.takerRelayerFee, makerProtocolFee = _f.makerProtocolFee, takerProtocolFee = _f.takerProtocolFee, makerReferrerFee = _f.makerReferrerFee, feeRecipient = _f.feeRecipient, feeMethod = _f.feeMethod;
|
|
2186
|
-
_g = (0, schema_1.encodeBuy)(schema, wyAsset, accountAddress,
|
|
2186
|
+
_g = (0, schema_1.encodeBuy)(schema, wyAsset, accountAddress, sellOrder ? undefined : utils_1.merkleValidatorByNetwork[this._networkName]), target = _g.target, calldata = _g.calldata, replacementPattern = _g.replacementPattern;
|
|
2187
2187
|
return [4 /*yield*/, this._getPriceParameters(types_1.OrderSide.Buy, paymentTokenAddress, expirationTime, startAmount)];
|
|
2188
2188
|
case 3:
|
|
2189
2189
|
_h = _k.sent(), basePrice = _h.basePrice, extra = _h.extra, paymentToken = _h.paymentToken;
|
|
@@ -2214,7 +2214,9 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2214
2214
|
side: types_1.OrderSide.Buy,
|
|
2215
2215
|
saleKind: types_1.SaleKind.FixedPrice,
|
|
2216
2216
|
target: target,
|
|
2217
|
-
howToCall:
|
|
2217
|
+
howToCall: target === utils_1.merkleValidatorByNetwork[this._networkName]
|
|
2218
|
+
? types_1.HowToCall.DelegateCall
|
|
2219
|
+
: types_1.HowToCall.Call,
|
|
2218
2220
|
calldata: calldata,
|
|
2219
2221
|
replacementPattern: replacementPattern,
|
|
2220
2222
|
staticTarget: staticTarget,
|
|
@@ -2256,10 +2258,9 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2256
2258
|
})];
|
|
2257
2259
|
case 2:
|
|
2258
2260
|
_d = _j.sent(), totalSellerFeeBasisPoints = _d.totalSellerFeeBasisPoints, totalBuyerFeeBasisPoints = _d.totalBuyerFeeBasisPoints, sellerBountyBasisPoints = _d.sellerBountyBasisPoints;
|
|
2259
|
-
_e = (0, schema_1.encodeSell)(schema, wyAsset, accountAddress,
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
}), target = _e.target, calldata = _e.calldata, replacementPattern = _e.replacementPattern;
|
|
2261
|
+
_e = (0, schema_1.encodeSell)(schema, wyAsset, accountAddress, waitForHighestBid
|
|
2262
|
+
? undefined
|
|
2263
|
+
: utils_1.merkleValidatorByNetwork[this._networkName]), target = _e.target, calldata = _e.calldata, replacementPattern = _e.replacementPattern;
|
|
2263
2264
|
orderSaleKind = endAmount != null && endAmount !== startAmount
|
|
2264
2265
|
? types_1.SaleKind.DutchAuction
|
|
2265
2266
|
: types_1.SaleKind.FixedPrice;
|
|
@@ -2572,8 +2573,8 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2572
2573
|
if ("asset" in order.metadata) {
|
|
2573
2574
|
var schema = _this._getSchema(order.metadata.schema);
|
|
2574
2575
|
return order.side == types_1.OrderSide.Buy
|
|
2575
|
-
? (0, schema_1.encodeSell)(schema, order.metadata.asset, recipientAddress, shouldValidate ?
|
|
2576
|
-
: (0, schema_1.encodeBuy)(schema, order.metadata.asset, recipientAddress, shouldValidate ?
|
|
2576
|
+
? (0, schema_1.encodeSell)(schema, order.metadata.asset, recipientAddress, shouldValidate ? order.target : undefined)
|
|
2577
|
+
: (0, schema_1.encodeBuy)(schema, order.metadata.asset, recipientAddress, shouldValidate ? order.target : undefined);
|
|
2577
2578
|
}
|
|
2578
2579
|
else if ("bundle" in order.metadata) {
|
|
2579
2580
|
// We're matching a bundle order
|
|
@@ -2718,7 +2719,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2718
2719
|
OpenSeaPort.prototype._sellOrderValidationAndApprovals = function (_b) {
|
|
2719
2720
|
var order = _b.order, accountAddress = _b.accountAddress;
|
|
2720
2721
|
return __awaiter(this, void 0, void 0, function () {
|
|
2721
|
-
var wyAssets, schemaNames, tokenAddress, minimumAmount,
|
|
2722
|
+
var wyAssets, schemaNames, tokenAddress, wyvernProtocol, minimumAmount, tokenTransferProxyAddress, sellValid;
|
|
2722
2723
|
return __generator(this, function (_c) {
|
|
2723
2724
|
switch (_c.label) {
|
|
2724
2725
|
case 0:
|
|
@@ -2733,40 +2734,46 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2733
2734
|
? [order.metadata.schema]
|
|
2734
2735
|
: [];
|
|
2735
2736
|
tokenAddress = order.paymentToken;
|
|
2736
|
-
|
|
2737
|
+
wyvernProtocol = this._getWyvernProtocolForOrder(order);
|
|
2738
|
+
return [4 /*yield*/, this._approveAll({
|
|
2739
|
+
schemaNames: schemaNames,
|
|
2740
|
+
wyAssets: wyAssets,
|
|
2741
|
+
accountAddress: accountAddress,
|
|
2742
|
+
wyvernProtocol: wyvernProtocol,
|
|
2743
|
+
})];
|
|
2737
2744
|
case 1:
|
|
2738
2745
|
_c.sent();
|
|
2739
2746
|
if (!(tokenAddress != constants_1.NULL_ADDRESS)) return [3 /*break*/, 3];
|
|
2740
2747
|
minimumAmount = (0, utils_1.makeBigNumber)(order.basePrice);
|
|
2748
|
+
tokenTransferProxyAddress = this._getWyvernTokenTransferProxyAddressForOrder(order);
|
|
2741
2749
|
return [4 /*yield*/, this.approveFungibleToken({
|
|
2742
2750
|
accountAddress: accountAddress,
|
|
2743
2751
|
tokenAddress: tokenAddress,
|
|
2744
2752
|
minimumAmount: minimumAmount,
|
|
2753
|
+
proxyAddress: tokenTransferProxyAddress,
|
|
2745
2754
|
})];
|
|
2746
2755
|
case 2:
|
|
2747
2756
|
_c.sent();
|
|
2748
2757
|
_c.label = 3;
|
|
2749
|
-
case 3:
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
order.salt,
|
|
2769
|
-
], order.feeMethod, order.side, order.saleKind, order.howToCall, order.calldata, order.replacementPattern, order.staticExtradata, { from: accountAddress })];
|
|
2758
|
+
case 3: return [4 /*yield*/, wyvernProtocol.wyvernExchange.validateOrderParameters_.callAsync([
|
|
2759
|
+
order.exchange,
|
|
2760
|
+
order.maker,
|
|
2761
|
+
order.taker,
|
|
2762
|
+
order.feeRecipient,
|
|
2763
|
+
order.target,
|
|
2764
|
+
order.staticTarget,
|
|
2765
|
+
order.paymentToken,
|
|
2766
|
+
], [
|
|
2767
|
+
order.makerRelayerFee,
|
|
2768
|
+
order.takerRelayerFee,
|
|
2769
|
+
order.makerProtocolFee,
|
|
2770
|
+
order.takerProtocolFee,
|
|
2771
|
+
order.basePrice,
|
|
2772
|
+
order.extra,
|
|
2773
|
+
order.listingTime,
|
|
2774
|
+
order.expirationTime,
|
|
2775
|
+
order.salt,
|
|
2776
|
+
], order.feeMethod, order.side, order.saleKind, order.howToCall, order.calldata, order.replacementPattern, order.staticExtradata, { from: accountAddress })];
|
|
2770
2777
|
case 4:
|
|
2771
2778
|
sellValid = _c.sent();
|
|
2772
2779
|
if (!sellValid) {
|
|
@@ -2784,7 +2791,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2784
2791
|
* @param order Order to approve
|
|
2785
2792
|
* @returns Transaction hash of the approval transaction
|
|
2786
2793
|
*/
|
|
2787
|
-
OpenSeaPort.prototype.
|
|
2794
|
+
OpenSeaPort.prototype.approveOrder = function (order) {
|
|
2788
2795
|
return __awaiter(this, void 0, void 0, function () {
|
|
2789
2796
|
var accountAddress, includeInOrderBook, wyvernProtocol, transactionHash;
|
|
2790
2797
|
var _this = this;
|
|
@@ -2868,27 +2875,28 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2868
2875
|
});
|
|
2869
2876
|
};
|
|
2870
2877
|
OpenSeaPort.prototype._approveAll = function (_b) {
|
|
2871
|
-
var schemaNames = _b.schemaNames, wyAssets = _b.wyAssets, accountAddress = _b.accountAddress, proxyAddress = _b.proxyAddress;
|
|
2878
|
+
var schemaNames = _b.schemaNames, wyAssets = _b.wyAssets, accountAddress = _b.accountAddress, proxyAddress = _b.proxyAddress, _c = _b.wyvernProtocol, wyvernProtocol = _c === void 0 ? this._wyvernProtocol : _c;
|
|
2872
2879
|
return __awaiter(this, void 0, void 0, function () {
|
|
2873
|
-
var
|
|
2880
|
+
var _d, contractsWithApproveAll;
|
|
2874
2881
|
var _this = this;
|
|
2875
|
-
return __generator(this, function (
|
|
2876
|
-
switch (
|
|
2882
|
+
return __generator(this, function (_e) {
|
|
2883
|
+
switch (_e.label) {
|
|
2877
2884
|
case 0:
|
|
2878
|
-
|
|
2879
|
-
if (
|
|
2880
|
-
return [4 /*yield*/, this._getProxy(accountAddress)];
|
|
2885
|
+
_d = proxyAddress;
|
|
2886
|
+
if (_d) return [3 /*break*/, 2];
|
|
2887
|
+
return [4 /*yield*/, this._getProxy(accountAddress, 0, wyvernProtocol)];
|
|
2881
2888
|
case 1:
|
|
2882
|
-
|
|
2883
|
-
|
|
2889
|
+
_d = (_e.sent());
|
|
2890
|
+
_e.label = 2;
|
|
2884
2891
|
case 2:
|
|
2885
2892
|
proxyAddress =
|
|
2886
|
-
|
|
2893
|
+
_d ||
|
|
2894
|
+
undefined;
|
|
2887
2895
|
if (!!proxyAddress) return [3 /*break*/, 4];
|
|
2888
|
-
return [4 /*yield*/, this._initializeProxy(accountAddress)];
|
|
2896
|
+
return [4 /*yield*/, this._initializeProxy(accountAddress, wyvernProtocol)];
|
|
2889
2897
|
case 3:
|
|
2890
|
-
proxyAddress =
|
|
2891
|
-
|
|
2898
|
+
proxyAddress = _e.sent();
|
|
2899
|
+
_e.label = 4;
|
|
2892
2900
|
case 4:
|
|
2893
2901
|
contractsWithApproveAll = new Set();
|
|
2894
2902
|
return [2 /*return*/, Promise.all(wyAssets.map(function (wyAsset, i) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2966,7 +2974,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2966
2974
|
OpenSeaPort.prototype._buyOrderValidationAndApprovals = function (_b) {
|
|
2967
2975
|
var order = _b.order, counterOrder = _b.counterOrder, accountAddress = _b.accountAddress;
|
|
2968
2976
|
return __awaiter(this, void 0, void 0, function () {
|
|
2969
|
-
var tokenAddress, balance, minimumAmount, wyvernProtocolReadOnly, buyValid;
|
|
2977
|
+
var tokenAddress, balance, minimumAmount, tokenTransferProxyAddress, wyvernProtocolReadOnly, buyValid;
|
|
2970
2978
|
return __generator(this, function (_c) {
|
|
2971
2979
|
switch (_c.label) {
|
|
2972
2980
|
case 0:
|
|
@@ -2995,12 +3003,14 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2995
3003
|
throw new Error("Insufficient balance.");
|
|
2996
3004
|
}
|
|
2997
3005
|
}
|
|
3006
|
+
tokenTransferProxyAddress = this._getWyvernTokenTransferProxyAddressForOrder(order);
|
|
2998
3007
|
// Check token approval
|
|
2999
3008
|
// This can be done at a higher level to show UI
|
|
3000
3009
|
return [4 /*yield*/, this.approveFungibleToken({
|
|
3001
3010
|
accountAddress: accountAddress,
|
|
3002
3011
|
tokenAddress: tokenAddress,
|
|
3003
3012
|
minimumAmount: minimumAmount,
|
|
3013
|
+
proxyAddress: tokenTransferProxyAddress,
|
|
3004
3014
|
})];
|
|
3005
3015
|
case 4:
|
|
3006
3016
|
// Check token approval
|
|
@@ -3477,7 +3487,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3477
3487
|
*/
|
|
3478
3488
|
OpenSeaPort.prototype.authorizeOrder = function (order) {
|
|
3479
3489
|
return __awaiter(this, void 0, void 0, function () {
|
|
3480
|
-
var signerAddress,
|
|
3490
|
+
var signerAddress, message_1, signerOrderNonce, orderForSigning, message, error_15;
|
|
3481
3491
|
return __generator(this, function (_b) {
|
|
3482
3492
|
switch (_b.label) {
|
|
3483
3493
|
case 0:
|
|
@@ -3486,29 +3496,18 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3486
3496
|
order: order,
|
|
3487
3497
|
accountAddress: order.maker,
|
|
3488
3498
|
});
|
|
3489
|
-
|
|
3499
|
+
_b.label = 1;
|
|
3490
3500
|
case 1:
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
// The web3 provider is probably a smart contract wallet.
|
|
3497
|
-
// Fallback to on-chain approval.
|
|
3498
|
-
return [4 /*yield*/, this._approveOrder(order)];
|
|
3499
|
-
case 3:
|
|
3500
|
-
// The web3 provider is probably a smart contract wallet.
|
|
3501
|
-
// Fallback to on-chain approval.
|
|
3502
|
-
_b.sent();
|
|
3503
|
-
return [2 /*return*/, null];
|
|
3504
|
-
case 4:
|
|
3505
|
-
if (!(order.exchange === utils_1.wyvern2_2AddressByNetwork[this._networkName] &&
|
|
3506
|
-
order.hash)) return [3 /*break*/, 6];
|
|
3501
|
+
_b.trys.push([1, 6, , 7]);
|
|
3502
|
+
if (!(order.exchange ===
|
|
3503
|
+
utils_1.wyvern2_2ConfigByNetwork[this._networkName]
|
|
3504
|
+
.wyvernExchangeContractAddress &&
|
|
3505
|
+
order.hash)) return [3 /*break*/, 3];
|
|
3507
3506
|
message_1 = order.hash;
|
|
3508
3507
|
return [4 /*yield*/, (0, utils_1.personalSignAsync)(this.web3, message_1, signerAddress)];
|
|
3509
|
-
case
|
|
3510
|
-
case
|
|
3511
|
-
case
|
|
3508
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
3509
|
+
case 3: return [4 /*yield*/, this.getNonce(signerAddress)];
|
|
3510
|
+
case 4:
|
|
3512
3511
|
signerOrderNonce = _b.sent();
|
|
3513
3512
|
orderForSigning = {
|
|
3514
3513
|
maker: order.maker,
|
|
@@ -3547,16 +3546,15 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3547
3546
|
message: __assign(__assign({}, orderForSigning), { nonce: signerOrderNonce.toNumber() }),
|
|
3548
3547
|
});
|
|
3549
3548
|
return [4 /*yield*/, (0, utils_1.signTypedDataAsync)(this.web3, message, signerAddress)];
|
|
3550
|
-
case
|
|
3551
|
-
case
|
|
3552
|
-
case 10:
|
|
3549
|
+
case 5: return [2 /*return*/, _b.sent()];
|
|
3550
|
+
case 6:
|
|
3553
3551
|
error_15 = _b.sent();
|
|
3554
3552
|
this._dispatch(types_1.EventType.OrderDenied, {
|
|
3555
3553
|
order: order,
|
|
3556
3554
|
accountAddress: signerAddress,
|
|
3557
3555
|
});
|
|
3558
3556
|
throw error_15;
|
|
3559
|
-
case
|
|
3557
|
+
case 7: return [2 /*return*/];
|
|
3560
3558
|
}
|
|
3561
3559
|
});
|
|
3562
3560
|
});
|
|
@@ -3669,13 +3667,23 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3669
3667
|
});
|
|
3670
3668
|
};
|
|
3671
3669
|
OpenSeaPort.prototype._getWyvernProtocolForOrder = function (order, useReadOnly) {
|
|
3672
|
-
if (order.exchange ===
|
|
3670
|
+
if (order.exchange ===
|
|
3671
|
+
utils_1.wyvern2_2ConfigByNetwork[this._networkName].wyvernExchangeContractAddress) {
|
|
3673
3672
|
return useReadOnly
|
|
3674
3673
|
? this._wyvern2_2ProtocolReadOnly
|
|
3675
3674
|
: this._wyvern2_2Protocol;
|
|
3676
3675
|
}
|
|
3677
3676
|
return useReadOnly ? this._wyvernProtocolReadOnly : this._wyvernProtocol;
|
|
3678
3677
|
};
|
|
3678
|
+
OpenSeaPort.prototype._getWyvernTokenTransferProxyAddressForOrder = function (order) {
|
|
3679
|
+
var _b;
|
|
3680
|
+
return ((order.exchange ===
|
|
3681
|
+
utils_1.wyvern2_2ConfigByNetwork[this._networkName].wyvernExchangeContractAddress
|
|
3682
|
+
? utils_1.wyvern2_2ConfigByNetwork[this._networkName]
|
|
3683
|
+
.wyvernTokenTransferProxyContractAddress
|
|
3684
|
+
: (_b = this._wyvernConfigOverride) === null || _b === void 0 ? void 0 : _b.wyvernTokenTransferProxyContractAddress) ||
|
|
3685
|
+
wyvern_js_1.WyvernProtocol.getTokenTransferProxyAddress(this._networkName));
|
|
3686
|
+
};
|
|
3679
3687
|
/**
|
|
3680
3688
|
* Returns whether or not an authenticated proxy is revoked for a specific account address
|
|
3681
3689
|
* @param accountAddress
|