opensea-js 2.0.0-beta.2 → 2.0.0-beta.6
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/constants.d.ts +0 -2
- package/lib/constants.js +1 -3
- package/lib/constants.js.map +1 -1
- package/lib/seaport.d.ts +13 -5
- package/lib/seaport.js +82 -58
- package/lib/seaport.js.map +1 -1
- package/lib/types.d.ts +6 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/utils.d.ts +11 -3
- package/lib/utils/utils.js +13 -4
- package/lib/utils/utils.js.map +1 -1
- package/package.json +3 -3
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.
|
|
@@ -711,11 +715,12 @@ export declare class OpenSeaPort {
|
|
|
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;
|
|
@@ -788,9 +793,11 @@ export declare class OpenSeaPort {
|
|
|
788
793
|
/**
|
|
789
794
|
* Generate the signature for authorizing an order
|
|
790
795
|
* @param order Unsigned wyvern order
|
|
791
|
-
* @returns order signature in the form of v, r, s
|
|
796
|
+
* @returns order signature in the form of v, r, s, also an optional nonce
|
|
792
797
|
*/
|
|
793
|
-
authorizeOrder(order: UnsignedOrder): Promise<ECSignature
|
|
798
|
+
authorizeOrder(order: UnsignedOrder): Promise<(ECSignature & {
|
|
799
|
+
nonce?: number;
|
|
800
|
+
}) | null>;
|
|
794
801
|
private _getSchema;
|
|
795
802
|
private _dispatch;
|
|
796
803
|
/**
|
|
@@ -801,6 +808,7 @@ export declare class OpenSeaPort {
|
|
|
801
808
|
private _confirmTransaction;
|
|
802
809
|
private _pollCallbackForConfirmation;
|
|
803
810
|
private _getWyvernProtocolForOrder;
|
|
811
|
+
private _getWyvernTokenTransferProxyAddressForOrder;
|
|
804
812
|
/**
|
|
805
813
|
* Returns whether or not an authenticated proxy is revoked for a specific account address
|
|
806
814
|
* @param accountAddress
|
package/lib/seaport.js
CHANGED
|
@@ -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 =
|
|
@@ -2049,14 +2044,16 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2049
2044
|
* Internal method exposed for dev flexibility.
|
|
2050
2045
|
* @param accountAddress The user's wallet address
|
|
2051
2046
|
* @param retries Optional number of retries to do
|
|
2047
|
+
* @param wyvernProtocol optional wyvern protocol override
|
|
2052
2048
|
*/
|
|
2053
|
-
OpenSeaPort.prototype._getProxy = function (accountAddress, retries) {
|
|
2049
|
+
OpenSeaPort.prototype._getProxy = function (accountAddress, retries, wyvernProtocol) {
|
|
2054
2050
|
if (retries === void 0) { retries = 0; }
|
|
2051
|
+
if (wyvernProtocol === void 0) { wyvernProtocol = this._wyvernProtocolReadOnly; }
|
|
2055
2052
|
return __awaiter(this, void 0, void 0, function () {
|
|
2056
2053
|
var proxyAddress;
|
|
2057
2054
|
return __generator(this, function (_b) {
|
|
2058
2055
|
switch (_b.label) {
|
|
2059
|
-
case 0: return [4 /*yield*/,
|
|
2056
|
+
case 0: return [4 /*yield*/, wyvernProtocol.wyvernProxyRegistry.proxies.callAsync(accountAddress)];
|
|
2060
2057
|
case 1:
|
|
2061
2058
|
proxyAddress = _b.sent();
|
|
2062
2059
|
if (proxyAddress == "0x") {
|
|
@@ -2083,8 +2080,10 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2083
2080
|
* trades can happen when the maker isn't online.
|
|
2084
2081
|
* Internal method exposed for dev flexibility.
|
|
2085
2082
|
* @param accountAddress The user's wallet address
|
|
2083
|
+
* @param wyvernProtocol optional wyvern protocol override
|
|
2086
2084
|
*/
|
|
2087
|
-
OpenSeaPort.prototype._initializeProxy = function (accountAddress) {
|
|
2085
|
+
OpenSeaPort.prototype._initializeProxy = function (accountAddress, wyvernProtocol) {
|
|
2086
|
+
if (wyvernProtocol === void 0) { wyvernProtocol = this._wyvernProtocol; }
|
|
2088
2087
|
return __awaiter(this, void 0, void 0, function () {
|
|
2089
2088
|
var txnData, gasEstimate, transactionHash, proxyAddress;
|
|
2090
2089
|
var _this = this;
|
|
@@ -2094,17 +2093,17 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2094
2093
|
this._dispatch(types_1.EventType.InitializeAccount, { accountAddress: accountAddress });
|
|
2095
2094
|
this.logger("Initializing proxy for account: ".concat(accountAddress));
|
|
2096
2095
|
txnData = { from: accountAddress };
|
|
2097
|
-
return [4 /*yield*/,
|
|
2096
|
+
return [4 /*yield*/, wyvernProtocol.wyvernProxyRegistry.registerProxy.estimateGasAsync(txnData)];
|
|
2098
2097
|
case 1:
|
|
2099
2098
|
gasEstimate = _b.sent();
|
|
2100
|
-
return [4 /*yield*/,
|
|
2099
|
+
return [4 /*yield*/, wyvernProtocol.wyvernProxyRegistry.registerProxy.sendTransactionAsync(__assign(__assign({}, txnData), { gas: this._correctGasAmount(gasEstimate) }))];
|
|
2101
2100
|
case 2:
|
|
2102
2101
|
transactionHash = _b.sent();
|
|
2103
2102
|
return [4 /*yield*/, this._confirmTransaction(transactionHash, types_1.EventType.InitializeAccount, "Initializing proxy for account", function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2104
2103
|
var polledProxy;
|
|
2105
2104
|
return __generator(this, function (_b) {
|
|
2106
2105
|
switch (_b.label) {
|
|
2107
|
-
case 0: return [4 /*yield*/, this._getProxy(accountAddress)];
|
|
2106
|
+
case 0: return [4 /*yield*/, this._getProxy(accountAddress, 0, wyvernProtocol)];
|
|
2108
2107
|
case 1:
|
|
2109
2108
|
polledProxy = _b.sent();
|
|
2110
2109
|
return [2 /*return*/, !!polledProxy];
|
|
@@ -2113,7 +2112,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2113
2112
|
}); })];
|
|
2114
2113
|
case 3:
|
|
2115
2114
|
_b.sent();
|
|
2116
|
-
return [4 /*yield*/, this._getProxy(accountAddress, 10)];
|
|
2115
|
+
return [4 /*yield*/, this._getProxy(accountAddress, 10, wyvernProtocol)];
|
|
2117
2116
|
case 4:
|
|
2118
2117
|
proxyAddress = _b.sent();
|
|
2119
2118
|
if (!proxyAddress) {
|
|
@@ -2217,7 +2216,9 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2217
2216
|
side: types_1.OrderSide.Buy,
|
|
2218
2217
|
saleKind: types_1.SaleKind.FixedPrice,
|
|
2219
2218
|
target: target,
|
|
2220
|
-
howToCall:
|
|
2219
|
+
howToCall: target === utils_1.merkleValidatorByNetwork[this._networkName]
|
|
2220
|
+
? types_1.HowToCall.DelegateCall
|
|
2221
|
+
: types_1.HowToCall.Call,
|
|
2221
2222
|
calldata: calldata,
|
|
2222
2223
|
replacementPattern: replacementPattern,
|
|
2223
2224
|
staticTarget: staticTarget,
|
|
@@ -2720,7 +2721,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2720
2721
|
OpenSeaPort.prototype._sellOrderValidationAndApprovals = function (_b) {
|
|
2721
2722
|
var order = _b.order, accountAddress = _b.accountAddress;
|
|
2722
2723
|
return __awaiter(this, void 0, void 0, function () {
|
|
2723
|
-
var wyAssets, schemaNames, tokenAddress, minimumAmount,
|
|
2724
|
+
var wyAssets, schemaNames, tokenAddress, wyvernProtocol, minimumAmount, tokenTransferProxyAddress, sellValid;
|
|
2724
2725
|
return __generator(this, function (_c) {
|
|
2725
2726
|
switch (_c.label) {
|
|
2726
2727
|
case 0:
|
|
@@ -2735,40 +2736,46 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2735
2736
|
? [order.metadata.schema]
|
|
2736
2737
|
: [];
|
|
2737
2738
|
tokenAddress = order.paymentToken;
|
|
2738
|
-
|
|
2739
|
+
wyvernProtocol = this._getWyvernProtocolForOrder(order);
|
|
2740
|
+
return [4 /*yield*/, this._approveAll({
|
|
2741
|
+
schemaNames: schemaNames,
|
|
2742
|
+
wyAssets: wyAssets,
|
|
2743
|
+
accountAddress: accountAddress,
|
|
2744
|
+
wyvernProtocol: wyvernProtocol,
|
|
2745
|
+
})];
|
|
2739
2746
|
case 1:
|
|
2740
2747
|
_c.sent();
|
|
2741
2748
|
if (!(tokenAddress != constants_1.NULL_ADDRESS)) return [3 /*break*/, 3];
|
|
2742
2749
|
minimumAmount = (0, utils_1.makeBigNumber)(order.basePrice);
|
|
2750
|
+
tokenTransferProxyAddress = this._getWyvernTokenTransferProxyAddressForOrder(order);
|
|
2743
2751
|
return [4 /*yield*/, this.approveFungibleToken({
|
|
2744
2752
|
accountAddress: accountAddress,
|
|
2745
2753
|
tokenAddress: tokenAddress,
|
|
2746
2754
|
minimumAmount: minimumAmount,
|
|
2755
|
+
proxyAddress: tokenTransferProxyAddress,
|
|
2747
2756
|
})];
|
|
2748
2757
|
case 2:
|
|
2749
2758
|
_c.sent();
|
|
2750
2759
|
_c.label = 3;
|
|
2751
|
-
case 3:
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
order.salt,
|
|
2771
|
-
], order.feeMethod, order.side, order.saleKind, order.howToCall, order.calldata, order.replacementPattern, order.staticExtradata, { from: accountAddress })];
|
|
2760
|
+
case 3: return [4 /*yield*/, wyvernProtocol.wyvernExchange.validateOrderParameters_.callAsync([
|
|
2761
|
+
order.exchange,
|
|
2762
|
+
order.maker,
|
|
2763
|
+
order.taker,
|
|
2764
|
+
order.feeRecipient,
|
|
2765
|
+
order.target,
|
|
2766
|
+
order.staticTarget,
|
|
2767
|
+
order.paymentToken,
|
|
2768
|
+
], [
|
|
2769
|
+
order.makerRelayerFee,
|
|
2770
|
+
order.takerRelayerFee,
|
|
2771
|
+
order.makerProtocolFee,
|
|
2772
|
+
order.takerProtocolFee,
|
|
2773
|
+
order.basePrice,
|
|
2774
|
+
order.extra,
|
|
2775
|
+
order.listingTime,
|
|
2776
|
+
order.expirationTime,
|
|
2777
|
+
order.salt,
|
|
2778
|
+
], order.feeMethod, order.side, order.saleKind, order.howToCall, order.calldata, order.replacementPattern, order.staticExtradata, { from: accountAddress })];
|
|
2772
2779
|
case 4:
|
|
2773
2780
|
sellValid = _c.sent();
|
|
2774
2781
|
if (!sellValid) {
|
|
@@ -2870,27 +2877,28 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2870
2877
|
});
|
|
2871
2878
|
};
|
|
2872
2879
|
OpenSeaPort.prototype._approveAll = function (_b) {
|
|
2873
|
-
var schemaNames = _b.schemaNames, wyAssets = _b.wyAssets, accountAddress = _b.accountAddress, proxyAddress = _b.proxyAddress;
|
|
2880
|
+
var schemaNames = _b.schemaNames, wyAssets = _b.wyAssets, accountAddress = _b.accountAddress, proxyAddress = _b.proxyAddress, _c = _b.wyvernProtocol, wyvernProtocol = _c === void 0 ? this._wyvernProtocol : _c;
|
|
2874
2881
|
return __awaiter(this, void 0, void 0, function () {
|
|
2875
|
-
var
|
|
2882
|
+
var _d, contractsWithApproveAll;
|
|
2876
2883
|
var _this = this;
|
|
2877
|
-
return __generator(this, function (
|
|
2878
|
-
switch (
|
|
2884
|
+
return __generator(this, function (_e) {
|
|
2885
|
+
switch (_e.label) {
|
|
2879
2886
|
case 0:
|
|
2880
|
-
|
|
2881
|
-
if (
|
|
2882
|
-
return [4 /*yield*/, this._getProxy(accountAddress)];
|
|
2887
|
+
_d = proxyAddress;
|
|
2888
|
+
if (_d) return [3 /*break*/, 2];
|
|
2889
|
+
return [4 /*yield*/, this._getProxy(accountAddress, 0, wyvernProtocol)];
|
|
2883
2890
|
case 1:
|
|
2884
|
-
|
|
2885
|
-
|
|
2891
|
+
_d = (_e.sent());
|
|
2892
|
+
_e.label = 2;
|
|
2886
2893
|
case 2:
|
|
2887
2894
|
proxyAddress =
|
|
2888
|
-
|
|
2895
|
+
_d ||
|
|
2896
|
+
undefined;
|
|
2889
2897
|
if (!!proxyAddress) return [3 /*break*/, 4];
|
|
2890
|
-
return [4 /*yield*/, this._initializeProxy(accountAddress)];
|
|
2898
|
+
return [4 /*yield*/, this._initializeProxy(accountAddress, wyvernProtocol)];
|
|
2891
2899
|
case 3:
|
|
2892
|
-
proxyAddress =
|
|
2893
|
-
|
|
2900
|
+
proxyAddress = _e.sent();
|
|
2901
|
+
_e.label = 4;
|
|
2894
2902
|
case 4:
|
|
2895
2903
|
contractsWithApproveAll = new Set();
|
|
2896
2904
|
return [2 /*return*/, Promise.all(wyAssets.map(function (wyAsset, i) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2968,7 +2976,7 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2968
2976
|
OpenSeaPort.prototype._buyOrderValidationAndApprovals = function (_b) {
|
|
2969
2977
|
var order = _b.order, counterOrder = _b.counterOrder, accountAddress = _b.accountAddress;
|
|
2970
2978
|
return __awaiter(this, void 0, void 0, function () {
|
|
2971
|
-
var tokenAddress, balance, minimumAmount, wyvernProtocolReadOnly, buyValid;
|
|
2979
|
+
var tokenAddress, balance, minimumAmount, tokenTransferProxyAddress, wyvernProtocolReadOnly, buyValid;
|
|
2972
2980
|
return __generator(this, function (_c) {
|
|
2973
2981
|
switch (_c.label) {
|
|
2974
2982
|
case 0:
|
|
@@ -2997,12 +3005,14 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
2997
3005
|
throw new Error("Insufficient balance.");
|
|
2998
3006
|
}
|
|
2999
3007
|
}
|
|
3008
|
+
tokenTransferProxyAddress = this._getWyvernTokenTransferProxyAddressForOrder(order);
|
|
3000
3009
|
// Check token approval
|
|
3001
3010
|
// This can be done at a higher level to show UI
|
|
3002
3011
|
return [4 /*yield*/, this.approveFungibleToken({
|
|
3003
3012
|
accountAddress: accountAddress,
|
|
3004
3013
|
tokenAddress: tokenAddress,
|
|
3005
3014
|
minimumAmount: minimumAmount,
|
|
3015
|
+
proxyAddress: tokenTransferProxyAddress,
|
|
3006
3016
|
})];
|
|
3007
3017
|
case 4:
|
|
3008
3018
|
// Check token approval
|
|
@@ -3475,11 +3485,11 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3475
3485
|
/**
|
|
3476
3486
|
* Generate the signature for authorizing an order
|
|
3477
3487
|
* @param order Unsigned wyvern order
|
|
3478
|
-
* @returns order signature in the form of v, r, s
|
|
3488
|
+
* @returns order signature in the form of v, r, s, also an optional nonce
|
|
3479
3489
|
*/
|
|
3480
3490
|
OpenSeaPort.prototype.authorizeOrder = function (order) {
|
|
3481
3491
|
return __awaiter(this, void 0, void 0, function () {
|
|
3482
|
-
var signerAddress, message_1, signerOrderNonce, orderForSigning, message, error_15;
|
|
3492
|
+
var signerAddress, message_1, signerOrderNonce, orderForSigning, message, ecSignature, error_15;
|
|
3483
3493
|
return __generator(this, function (_b) {
|
|
3484
3494
|
switch (_b.label) {
|
|
3485
3495
|
case 0:
|
|
@@ -3491,7 +3501,9 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3491
3501
|
_b.label = 1;
|
|
3492
3502
|
case 1:
|
|
3493
3503
|
_b.trys.push([1, 6, , 7]);
|
|
3494
|
-
if (!(order.exchange ===
|
|
3504
|
+
if (!(order.exchange ===
|
|
3505
|
+
utils_1.wyvern2_2ConfigByNetwork[this._networkName]
|
|
3506
|
+
.wyvernExchangeContractAddress &&
|
|
3495
3507
|
order.hash)) return [3 /*break*/, 3];
|
|
3496
3508
|
message_1 = order.hash;
|
|
3497
3509
|
return [4 /*yield*/, (0, utils_1.personalSignAsync)(this.web3, message_1, signerAddress)];
|
|
@@ -3536,7 +3548,9 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3536
3548
|
message: __assign(__assign({}, orderForSigning), { nonce: signerOrderNonce.toNumber() }),
|
|
3537
3549
|
});
|
|
3538
3550
|
return [4 /*yield*/, (0, utils_1.signTypedDataAsync)(this.web3, message, signerAddress)];
|
|
3539
|
-
case 5:
|
|
3551
|
+
case 5:
|
|
3552
|
+
ecSignature = _b.sent();
|
|
3553
|
+
return [2 /*return*/, __assign(__assign({}, ecSignature), { nonce: signerOrderNonce.toNumber() })];
|
|
3540
3554
|
case 6:
|
|
3541
3555
|
error_15 = _b.sent();
|
|
3542
3556
|
this._dispatch(types_1.EventType.OrderDenied, {
|
|
@@ -3657,13 +3671,23 @@ var OpenSeaPort = /** @class */ (function () {
|
|
|
3657
3671
|
});
|
|
3658
3672
|
};
|
|
3659
3673
|
OpenSeaPort.prototype._getWyvernProtocolForOrder = function (order, useReadOnly) {
|
|
3660
|
-
if (order.exchange ===
|
|
3674
|
+
if (order.exchange ===
|
|
3675
|
+
utils_1.wyvern2_2ConfigByNetwork[this._networkName].wyvernExchangeContractAddress) {
|
|
3661
3676
|
return useReadOnly
|
|
3662
3677
|
? this._wyvern2_2ProtocolReadOnly
|
|
3663
3678
|
: this._wyvern2_2Protocol;
|
|
3664
3679
|
}
|
|
3665
3680
|
return useReadOnly ? this._wyvernProtocolReadOnly : this._wyvernProtocol;
|
|
3666
3681
|
};
|
|
3682
|
+
OpenSeaPort.prototype._getWyvernTokenTransferProxyAddressForOrder = function (order) {
|
|
3683
|
+
var _b;
|
|
3684
|
+
return ((order.exchange ===
|
|
3685
|
+
utils_1.wyvern2_2ConfigByNetwork[this._networkName].wyvernExchangeContractAddress
|
|
3686
|
+
? utils_1.wyvern2_2ConfigByNetwork[this._networkName]
|
|
3687
|
+
.wyvernTokenTransferProxyContractAddress
|
|
3688
|
+
: (_b = this._wyvernConfigOverride) === null || _b === void 0 ? void 0 : _b.wyvernTokenTransferProxyContractAddress) ||
|
|
3689
|
+
wyvern_js_1.WyvernProtocol.getTokenTransferProxyAddress(this._networkName));
|
|
3690
|
+
};
|
|
3667
3691
|
/**
|
|
3668
3692
|
* Returns whether or not an authenticated proxy is revoked for a specific account address
|
|
3669
3693
|
* @param accountAddress
|