@imtbl/sdk 0.27.11 → 0.27.13
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/dist/blockchain_data.d.ts +1 -1
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +16 -9
- package/dist/checkout_sdk.js +112 -69
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +10 -10
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +122 -79
- package/dist/index.d.ts +68 -41
- package/dist/index.js +122 -79
- package/dist/orderbook.d.ts +45 -25
- package/dist/orderbook.js +14 -2
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -11198,7 +11198,7 @@ type ERC20BuyToken = {
|
|
|
11198
11198
|
contractAddress: string;
|
|
11199
11199
|
};
|
|
11200
11200
|
/**
|
|
11201
|
-
*
|
|
11201
|
+
* The SellToken type
|
|
11202
11202
|
* @property {string} id - The ERC721 token id
|
|
11203
11203
|
* @property {string} collectionAddress - The ERC721 collection address
|
|
11204
11204
|
*/
|
|
@@ -11529,9 +11529,9 @@ type UserBalance = {
|
|
|
11529
11529
|
* Represents the transaction requirement for a transaction.
|
|
11530
11530
|
* @property {ItemType} type - The type of the transaction requirement.
|
|
11531
11531
|
* @property {boolean} sufficient - If the user address has sufficient funds to cover the transaction.
|
|
11532
|
-
* @property {
|
|
11533
|
-
* @property {
|
|
11534
|
-
* @property {
|
|
11532
|
+
* @property {ItemBalance} required - The required item balance.
|
|
11533
|
+
* @property {ItemBalance} current - The current item balance.
|
|
11534
|
+
* @property {BalanceDelta} delta - The delta between the required and current balances.
|
|
11535
11535
|
*/
|
|
11536
11536
|
type TransactionRequirement = {
|
|
11537
11537
|
type: ItemType;
|
|
@@ -11542,6 +11542,7 @@ type TransactionRequirement = {
|
|
|
11542
11542
|
};
|
|
11543
11543
|
/**
|
|
11544
11544
|
* Represents the balance for either a native or ERC20 token.
|
|
11545
|
+
* @property {ItemType.NATIVE | ItemType.ERC20} type - Type to indicate this is a native or ERC20 token.
|
|
11545
11546
|
* @property {BigNumber} balance - The balance of the item.
|
|
11546
11547
|
* @property {string} formattedBalance - The formatted balance of the item.
|
|
11547
11548
|
* @property {TokenInfo} token - The token info of the item.
|
|
@@ -11553,18 +11554,20 @@ type TokenBalance = {
|
|
|
11553
11554
|
token: TokenInfo;
|
|
11554
11555
|
};
|
|
11555
11556
|
/**
|
|
11556
|
-
* Represents the balance for an
|
|
11557
|
+
* Represents the balance for an ERC721.
|
|
11558
|
+
* @property {ItemType.ERC721} type - Type to indicate this is an ERC721 token.
|
|
11557
11559
|
* @property {BigNumber} balance - The balance of the item.
|
|
11558
11560
|
* @property {string} formattedBalance - The formatted balance of the item.
|
|
11559
|
-
* @property {
|
|
11561
|
+
* @property {string} contractAddress - The contract address of the ERC721 collection.
|
|
11562
|
+
* @property {string} id - The ID of the ERC721 in the collection.
|
|
11560
11563
|
*/
|
|
11561
|
-
|
|
11564
|
+
type ERC721Balance = {
|
|
11562
11565
|
type: ItemType.ERC721;
|
|
11563
11566
|
balance: BigNumber;
|
|
11564
11567
|
formattedBalance: string;
|
|
11565
11568
|
contractAddress: string;
|
|
11566
11569
|
id: string;
|
|
11567
|
-
}
|
|
11570
|
+
};
|
|
11568
11571
|
/**
|
|
11569
11572
|
* Type representing the balance of an item.
|
|
11570
11573
|
*/
|
|
@@ -11581,6 +11584,9 @@ type BalanceDelta = {
|
|
|
11581
11584
|
/**
|
|
11582
11585
|
* A type representing the Smart Checkout routing options available for a user
|
|
11583
11586
|
* if they are configured and enabled (not geo-blocked etc.)
|
|
11587
|
+
* @property {boolean | undefined} onRamp - If the user can use onramp
|
|
11588
|
+
* @property {boolean | undefined} swap - If the user can use swap
|
|
11589
|
+
* @property {boolean | undefined} bridge - If the user can use bridge
|
|
11584
11590
|
*/
|
|
11585
11591
|
type AvailableRoutingOptions = {
|
|
11586
11592
|
onRamp?: boolean;
|
|
@@ -12103,7 +12109,8 @@ declare enum CheckoutErrorType {
|
|
|
12103
12109
|
BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
|
|
12104
12110
|
ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
|
|
12105
12111
|
ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
|
|
12106
|
-
API_ERROR = "API_ERROR"
|
|
12112
|
+
API_ERROR = "API_ERROR",
|
|
12113
|
+
ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR"
|
|
12107
12114
|
}
|
|
12108
12115
|
/**
|
|
12109
12116
|
* Represents an error object with a specific type, optional message, and optional data.
|
package/dist/checkout_sdk.js
CHANGED
|
@@ -16187,7 +16187,7 @@ class OrdersService {
|
|
|
16187
16187
|
* @returns ListListingsResult OK response.
|
|
16188
16188
|
* @throws ApiError
|
|
16189
16189
|
*/
|
|
16190
|
-
listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
16190
|
+
listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
16191
16191
|
return this.httpRequest.request({
|
|
16192
16192
|
method: 'GET',
|
|
16193
16193
|
url: '/v1/chains/{chain_name}/orders/listings',
|
|
@@ -16199,6 +16199,7 @@ class OrdersService {
|
|
|
16199
16199
|
'sell_item_contract_address': sellItemContractAddress,
|
|
16200
16200
|
'buy_item_contract_address': buyItemContractAddress,
|
|
16201
16201
|
'sell_item_token_id': sellItemTokenId,
|
|
16202
|
+
'from_updated_at': fromUpdatedAt,
|
|
16202
16203
|
'page_size': pageSize,
|
|
16203
16204
|
'sort_by': sortBy,
|
|
16204
16205
|
'sort_direction': sortDirection,
|
|
@@ -16282,7 +16283,7 @@ class OrdersService {
|
|
|
16282
16283
|
* @returns ListTradeResult OK response.
|
|
16283
16284
|
* @throws ApiError
|
|
16284
16285
|
*/
|
|
16285
|
-
listTrades({ chainName, accountAddress, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
16286
|
+
listTrades({ chainName, accountAddress, fromIndexedAt, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
16286
16287
|
return this.httpRequest.request({
|
|
16287
16288
|
method: 'GET',
|
|
16288
16289
|
url: '/v1/chains/{chain_name}/trades',
|
|
@@ -16291,6 +16292,7 @@ class OrdersService {
|
|
|
16291
16292
|
},
|
|
16292
16293
|
query: {
|
|
16293
16294
|
'account_address': accountAddress,
|
|
16295
|
+
'from_indexed_at': fromIndexedAt,
|
|
16294
16296
|
'page_size': pageSize,
|
|
16295
16297
|
'sort_by': sortBy,
|
|
16296
16298
|
'sort_direction': sortDirection,
|
|
@@ -16356,6 +16358,16 @@ var CancelledOrderStatus;
|
|
|
16356
16358
|
})(CancelledOrderStatus.cancellation_type || (CancelledOrderStatus.cancellation_type = {}));
|
|
16357
16359
|
})(CancelledOrderStatus || (CancelledOrderStatus = {}));
|
|
16358
16360
|
|
|
16361
|
+
/* istanbul ignore file */
|
|
16362
|
+
/* tslint:disable */
|
|
16363
|
+
/* eslint-disable */
|
|
16364
|
+
var FailedOrderCancellation;
|
|
16365
|
+
(function (FailedOrderCancellation) {
|
|
16366
|
+
(function (reason_code) {
|
|
16367
|
+
reason_code["ALREADY_FILLED"] = "ALREADY_FILLED";
|
|
16368
|
+
})(FailedOrderCancellation.reason_code || (FailedOrderCancellation.reason_code = {}));
|
|
16369
|
+
})(FailedOrderCancellation || (FailedOrderCancellation = {}));
|
|
16370
|
+
|
|
16359
16371
|
/* istanbul ignore file */
|
|
16360
16372
|
/* tslint:disable */
|
|
16361
16373
|
/* eslint-disable */
|
|
@@ -20587,7 +20599,7 @@ class APIError extends Error {
|
|
|
20587
20599
|
|
|
20588
20600
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20589
20601
|
const defaultHeaders = {
|
|
20590
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.
|
|
20602
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.13',
|
|
20591
20603
|
};
|
|
20592
20604
|
/**
|
|
20593
20605
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -21501,6 +21513,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
|
21501
21513
|
CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
|
|
21502
21514
|
CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
|
|
21503
21515
|
CheckoutErrorType["API_ERROR"] = "API_ERROR";
|
|
21516
|
+
CheckoutErrorType["ORDER_EXPIRED_ERROR"] = "ORDER_EXPIRED_ERROR";
|
|
21504
21517
|
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
21505
21518
|
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
21506
21519
|
message;
|
|
@@ -21954,6 +21967,20 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
|
|
|
21954
21967
|
|
|
21955
21968
|
|
|
21956
21969
|
|
|
21970
|
+
const $458d407830d66110$export$e6a390ea6399b7d8 = (config, debugString, seconds)=>{
|
|
21971
|
+
// eslint-disable-next-line no-console
|
|
21972
|
+
if (!config.isProduction) console.debug(debugString, seconds);
|
|
21973
|
+
};
|
|
21974
|
+
const $458d407830d66110$export$5280dbcb91c8b391 = async (config, debugString, promise)=>{
|
|
21975
|
+
const startTime = performance.now();
|
|
21976
|
+
const result = await promise;
|
|
21977
|
+
const endTime = performance.now();
|
|
21978
|
+
const elapsedTimeInSeconds = (endTime - startTime) / 1000;
|
|
21979
|
+
$458d407830d66110$export$e6a390ea6399b7d8(config, debugString, elapsedTimeInSeconds);
|
|
21980
|
+
return result;
|
|
21981
|
+
};
|
|
21982
|
+
|
|
21983
|
+
|
|
21957
21984
|
const $1564e43dde50bb61$export$df96cd8d56be0ab1 = async (config, web3Provider, walletAddress)=>await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
21958
21985
|
const networkInfo = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(config, web3Provider);
|
|
21959
21986
|
if (!networkInfo.isSupported) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${networkInfo.chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR, {
|
|
@@ -22108,12 +22135,12 @@ const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, web3Provider, w
|
|
|
22108
22135
|
// Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
|
|
22109
22136
|
// is done.
|
|
22110
22137
|
const isL1Chain = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config) === chainId;
|
|
22111
|
-
return
|
|
22138
|
+
return ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using blockscout for ${chainId}`, $1564e43dde50bb61$export$8c978679845804d4(walletAddress, chainId, isL1Chain ? tokens : []));
|
|
22112
22139
|
}
|
|
22113
22140
|
// This fallback to use ERC20s calls which is a best effort solution
|
|
22114
22141
|
// Fails in fetching data from the RCP calls might result in some
|
|
22115
22142
|
// missing data.
|
|
22116
|
-
return await $1564e43dde50bb61$export$a3238cee431627c6(config, web3Provider, walletAddress, tokens);
|
|
22143
|
+
return await ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using RPC for ${chainId}`, $1564e43dde50bb61$export$a3238cee431627c6(config, web3Provider, walletAddress, tokens));
|
|
22117
22144
|
};
|
|
22118
22145
|
|
|
22119
22146
|
|
|
@@ -22354,7 +22381,7 @@ async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
|
|
|
22354
22381
|
overrides: dexConfig?.overrides
|
|
22355
22382
|
});
|
|
22356
22383
|
}
|
|
22357
|
-
|
|
22384
|
+
function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
|
|
22358
22385
|
return new (Orderbook)({
|
|
22359
22386
|
baseConfig: {
|
|
22360
22387
|
environment: config.environment
|
|
@@ -23155,8 +23182,8 @@ const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=
|
|
|
23155
23182
|
|
|
23156
23183
|
|
|
23157
23184
|
|
|
23158
|
-
const $1fda5c40669a566d$export$
|
|
23159
|
-
const $1fda5c40669a566d$export$
|
|
23185
|
+
const $1fda5c40669a566d$export$5d79dcabf4595ae0 = async ()=>true;
|
|
23186
|
+
const $1fda5c40669a566d$export$2c2bcd6e0d9a9969 = async (config)=>{
|
|
23160
23187
|
const availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(config.isDevelopment, config.isProduction);
|
|
23161
23188
|
try {
|
|
23162
23189
|
return await availability.checkDexAvailability();
|
|
@@ -23177,18 +23204,18 @@ const $7f2e17f026d4fc8d$export$86d9f998ddda013e = async (config, provider)=>{
|
|
|
23177
23204
|
const geoBlockingChecks = [];
|
|
23178
23205
|
if (availableRoutingOptions.onRamp) geoBlockingChecks.push({
|
|
23179
23206
|
id: "onRamp",
|
|
23180
|
-
promise: ($1fda5c40669a566d$export$
|
|
23207
|
+
promise: ($1fda5c40669a566d$export$5d79dcabf4595ae0)()
|
|
23181
23208
|
});
|
|
23182
23209
|
if (availableRoutingOptions.swap) geoBlockingChecks.push({
|
|
23183
23210
|
id: "swap",
|
|
23184
|
-
promise: ($1fda5c40669a566d$export$
|
|
23211
|
+
promise: ($1fda5c40669a566d$export$2c2bcd6e0d9a9969)(config)
|
|
23185
23212
|
});
|
|
23186
23213
|
if (geoBlockingChecks.length > 0) {
|
|
23187
23214
|
const promises = geoBlockingChecks.map((geoBlockingCheck)=>geoBlockingCheck.promise);
|
|
23188
23215
|
const geoBlockingStatus = await Promise.allSettled(promises);
|
|
23189
23216
|
geoBlockingStatus.forEach((result, index)=>{
|
|
23190
23217
|
const statusId = geoBlockingChecks[index].id;
|
|
23191
|
-
availableRoutingOptions[statusId] = availableRoutingOptions[statusId] && result.status === "fulfilled" &&
|
|
23218
|
+
availableRoutingOptions[statusId] = availableRoutingOptions[statusId] && result.status === "fulfilled" && result.value;
|
|
23192
23219
|
});
|
|
23193
23220
|
}
|
|
23194
23221
|
// Bridge not available if passport provider
|
|
@@ -23295,7 +23322,7 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
|
|
|
23295
23322
|
}
|
|
23296
23323
|
// Resolve all the quotes and link them back to the swappable token
|
|
23297
23324
|
// The swappable token array is in the same position in the array as the quote in the promise array
|
|
23298
|
-
const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
|
|
23325
|
+
const dexTransactionResponse = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to resolve swap quotes from the dex", Promise.allSettled(dexTransactionResponsePromises));
|
|
23299
23326
|
dexTransactionResponse.forEach((response, index)=>{
|
|
23300
23327
|
if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
|
|
23301
23328
|
const swappableToken = fromToken[index];
|
|
@@ -23312,15 +23339,6 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
|
|
|
23312
23339
|
};
|
|
23313
23340
|
|
|
23314
23341
|
|
|
23315
|
-
const $3ee85f12225c19f3$export$fb80fe94a81a3132 = async (config, dexQuoteCache, walletAddress, requiredToken, swappableTokens)=>{
|
|
23316
|
-
const dexQuotes = dexQuoteCache.get(requiredToken.address);
|
|
23317
|
-
if (dexQuotes && dexQuotes.size > 0) return dexQuotes;
|
|
23318
|
-
const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
|
|
23319
|
-
dexQuoteCache.set(requiredToken.address, quotes);
|
|
23320
|
-
return quotes;
|
|
23321
|
-
};
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
23342
|
const $91807edfd7057288$var$constructFees = (approvalGasFees, swapGasFees, swapFees)=>{
|
|
23325
23343
|
let approvalGasFeeAmount = (BigNumber$1).from(0);
|
|
23326
23344
|
let approvalGasFeeFormatted = "0";
|
|
@@ -23448,11 +23466,17 @@ const $91807edfd7057288$export$7b6318fc1a8067b3 = (l2Balances, approval)=>{
|
|
|
23448
23466
|
approvalGasTokenAddress: approvalGasTokenAddress
|
|
23449
23467
|
};
|
|
23450
23468
|
};
|
|
23451
|
-
const $91807edfd7057288$export$38077235fe748d40 = (l2Balances,
|
|
23469
|
+
const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, approvalFees, swapGasFees, swapFees, tokenBeingSwapped)=>{
|
|
23452
23470
|
// Set up a map of token addresses to amounts for each of the swap fees
|
|
23453
23471
|
const feeMap = new Map();
|
|
23454
23472
|
// Add the approval fee to list of fees
|
|
23455
23473
|
if (approvalFees.approvalGasTokenAddress !== "") feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
|
|
23474
|
+
// Add the swap gas fee to list of fees
|
|
23475
|
+
if (swapGasFees) {
|
|
23476
|
+
const fee = feeMap.get(swapGasFees.token.address);
|
|
23477
|
+
if (fee) feeMap.set(swapGasFees.token.address, fee.add(swapGasFees.value));
|
|
23478
|
+
else feeMap.set(swapGasFees.token.address, swapGasFees.value);
|
|
23479
|
+
}
|
|
23456
23480
|
// Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
|
|
23457
23481
|
if (tokenBeingSwapped) {
|
|
23458
23482
|
const fee = feeMap.get(tokenBeingSwapped.address);
|
|
@@ -23501,7 +23525,7 @@ const $91807edfd7057288$export$567a0c83c08c514b = (l2balance, balanceRequirement
|
|
|
23501
23525
|
// that is going to be swapped from another item requirement then return true
|
|
23502
23526
|
return remainingBalance.gte(amountBeingSwapped);
|
|
23503
23527
|
};
|
|
23504
|
-
const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions,
|
|
23528
|
+
const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens, balanceRequirements)=>{
|
|
23505
23529
|
const fundingSteps = [];
|
|
23506
23530
|
if (!availableRoutingOptions.swap) return fundingSteps;
|
|
23507
23531
|
if (swappableTokens.length === 0) return fundingSteps;
|
|
@@ -23512,7 +23536,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
23512
23536
|
if (!l2TokenBalanceResult) return fundingSteps;
|
|
23513
23537
|
const l2Balances = l2TokenBalanceResult.balances;
|
|
23514
23538
|
if (l2Balances.length === 0) return fundingSteps;
|
|
23515
|
-
const quotes = await ($
|
|
23539
|
+
const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
|
|
23516
23540
|
const quoteTokenAddresses = Array.from(quotes.keys());
|
|
23517
23541
|
for (const quoteTokenAddress of quoteTokenAddresses){
|
|
23518
23542
|
const quote = quotes.get(quoteTokenAddress);
|
|
@@ -23529,7 +23553,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
23529
23553
|
// If user does not have enough to cover approval fees then continue
|
|
23530
23554
|
if (!approvalFees.sufficient) continue;
|
|
23531
23555
|
// If user does not have enough to cover swap fees then continue
|
|
23532
|
-
if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, quote.quote.fees,
|
|
23556
|
+
if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, approvalFees, quote.swap, quote.quote.fees, {
|
|
23533
23557
|
amount: amountOfQuoteTokenRequired.value,
|
|
23534
23558
|
address: quoteTokenAddress
|
|
23535
23559
|
})) continue;
|
|
@@ -23934,13 +23958,14 @@ const $7500587317643fc8$export$c3e193fd573f1a94 = async (config, swappableTokens
|
|
|
23934
23958
|
|
|
23935
23959
|
|
|
23936
23960
|
|
|
23937
|
-
|
|
23961
|
+
|
|
23962
|
+
const $d54df4a884f14123$export$d46f2133747ffd93 = async (config, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens)=>{
|
|
23938
23963
|
const filteredSwappableTokensAddresses = [];
|
|
23939
23964
|
for (const token of filteredSwappableTokens){
|
|
23940
23965
|
if (!token.address) continue;
|
|
23941
23966
|
filteredSwappableTokensAddresses.push(token.address);
|
|
23942
23967
|
}
|
|
23943
|
-
const dexQuotes = await ($
|
|
23968
|
+
const dexQuotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), ownerAddress, {
|
|
23944
23969
|
address: requiredTokenAddress,
|
|
23945
23970
|
amount: insufficientRequirement.delta.balance
|
|
23946
23971
|
}, filteredSwappableTokensAddresses);
|
|
@@ -24050,7 +24075,7 @@ const $afd57acae9471ac5$export$d9b96654eebdaf2a = (bridgeFundingSteps, swapFundi
|
|
|
24050
24075
|
}
|
|
24051
24076
|
return bridgeAndSwapRoutes;
|
|
24052
24077
|
};
|
|
24053
|
-
const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
24078
|
+
const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, feeEstimates, tokenBalances, bridgeableTokens, swappableTokens, balanceRequirements)=>{
|
|
24054
24079
|
const { l1balances: l1balances, l2balances: l2balances } = ($7bb5af1d8b5d9127$export$8280985cc3da7882)(config, tokenBalances);
|
|
24055
24080
|
const requiredTokenAddress = insufficientRequirement.required.token.address;
|
|
24056
24081
|
if ($afd57acae9471ac5$export$b94e88f4f8805f71(bridgeableTokens, swappableTokens, l1balances, l2balances, availableRoutingOptions, requiredTokenAddress)) return [];
|
|
@@ -24061,7 +24086,7 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
|
|
|
24061
24086
|
const filteredSwappableTokens = $afd57acae9471ac5$export$ed7c59bd8d1bb5a7(requiredTokenAddress, bridgeableTokens, swappableTokens, l1tol2Addresses);
|
|
24062
24087
|
if (filteredSwappableTokens.length === 0) return [];
|
|
24063
24088
|
// Fetch all the dex quotes from the list of swappable tokens
|
|
24064
|
-
const dexQuotes = await ($d54df4a884f14123$export$d46f2133747ffd93)(config,
|
|
24089
|
+
const dexQuotes = await ($d54df4a884f14123$export$d46f2133747ffd93)(config, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens);
|
|
24065
24090
|
// Construct bridge requirements based on L2 balances, slippage and swap fees
|
|
24066
24091
|
const bridgeRequirements = ($62e968a3dd87940e$export$df667c749c93b110)(dexQuotes, l1balances, l2balances, l1tol2Addresses, balanceRequirements);
|
|
24067
24092
|
if (bridgeRequirements.length === 0) return [];
|
|
@@ -24104,7 +24129,7 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
|
|
|
24104
24129
|
// Modify the users L2 balance to include the amount as if the user successfully bridged
|
|
24105
24130
|
const modifiedTokenBalances = $afd57acae9471ac5$var$modifyTokenBalancesWithBridgedAmount(config, tokenBalances, l2balances, bridgedTokens, swappableTokens);
|
|
24106
24131
|
// Call the swap route with the faked bridged balances
|
|
24107
|
-
const swapRoutes = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions,
|
|
24132
|
+
const swapRoutes = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, ownerAddress, insufficientRequirement, modifiedTokenBalances, swappableTokensAfterBridging, balanceRequirements);
|
|
24108
24133
|
if (!swapRoutes) return [];
|
|
24109
24134
|
const originalBalanceSwapRoutes = $afd57acae9471ac5$export$1fc63300bde5e690(tokenBalances, swapRoutes);
|
|
24110
24135
|
return $afd57acae9471ac5$export$d9b96654eebdaf2a(bridgeResults, originalBalanceSwapRoutes, l1tol2Addresses);
|
|
@@ -24146,6 +24171,7 @@ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutin
|
|
|
24146
24171
|
|
|
24147
24172
|
|
|
24148
24173
|
|
|
24174
|
+
|
|
24149
24175
|
const $c16168a9c28ae4fd$var$hasAvailableRoutingOptions = (availableRoutingOptions)=>availableRoutingOptions.bridge || availableRoutingOptions.swap || availableRoutingOptions.onRamp;
|
|
24150
24176
|
const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
24151
24177
|
let insufficientBalanceCount = 0;
|
|
@@ -24169,7 +24195,7 @@ const $c16168a9c28ae4fd$export$ab86023c267660 = async (config, readOnlyProviders
|
|
|
24169
24195
|
if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, bridgeRequirement, tokenBalances, feeEstimates);
|
|
24170
24196
|
return bridgeFundingStep;
|
|
24171
24197
|
};
|
|
24172
|
-
const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement,
|
|
24198
|
+
const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, swapTokenAllowList, balanceRequirements)=>{
|
|
24173
24199
|
const fundingSteps = [];
|
|
24174
24200
|
if (!availableRoutingOptions.swap) return fundingSteps;
|
|
24175
24201
|
if (insufficientRequirement === undefined) return fundingSteps;
|
|
@@ -24180,9 +24206,9 @@ const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutin
|
|
|
24180
24206
|
if (swapTokenAllowList.length === 0) return fundingSteps;
|
|
24181
24207
|
const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
|
|
24182
24208
|
if (swappableTokens.length === 0) return fundingSteps;
|
|
24183
|
-
return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions,
|
|
24209
|
+
return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens, balanceRequirements);
|
|
24184
24210
|
};
|
|
24185
|
-
const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
24211
|
+
const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, tokenAllowList, feeEstimates, balanceRequirements)=>{
|
|
24186
24212
|
if (!insufficientRequirement) return [];
|
|
24187
24213
|
const l1balancesResult = tokenBalances.get(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
|
|
24188
24214
|
const l2balancesResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
@@ -24200,7 +24226,7 @@ const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProvide
|
|
|
24200
24226
|
});
|
|
24201
24227
|
const swapTokenAllowList = tokenAllowList?.swap ?? [];
|
|
24202
24228
|
if (insufficientRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE && insufficientRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return [];
|
|
24203
|
-
const routes = await ($afd57acae9471ac5$export$f95ed27e871fe308)(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
24229
|
+
const routes = await ($afd57acae9471ac5$export$f95ed27e871fe308)(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, feeEstimates, tokenBalances, bridgeableL1Addresses, swapTokenAllowList, balanceRequirements);
|
|
24204
24230
|
return routes;
|
|
24205
24231
|
};
|
|
24206
24232
|
const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
|
|
@@ -24222,20 +24248,18 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
24222
24248
|
message: err.message
|
|
24223
24249
|
});
|
|
24224
24250
|
}
|
|
24225
|
-
const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
|
|
24226
|
-
const allowList = await ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions);
|
|
24227
|
-
//
|
|
24251
|
+
const tokenBalances = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get token balances inside router", ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions));
|
|
24252
|
+
const allowList = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get routing allowlist", ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions));
|
|
24253
|
+
// Fee estimate cache
|
|
24228
24254
|
const feeEstimates = new Map();
|
|
24229
|
-
// Dex quotes cache
|
|
24230
|
-
const dexQuoteCache = new Map();
|
|
24231
24255
|
// Ensures only 1 balance requirement is insufficient
|
|
24232
24256
|
const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
|
|
24233
24257
|
const routePromises = [];
|
|
24234
24258
|
routePromises.push($c16168a9c28ae4fd$export$ab86023c267660(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, feeEstimates));
|
|
24235
|
-
routePromises.push($c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement,
|
|
24259
|
+
routePromises.push($c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, allowList.swap, balanceRequirements));
|
|
24236
24260
|
routePromises.push($c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement));
|
|
24237
|
-
routePromises.push($c16168a9c28ae4fd$export$2becd43da9d21f73(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
24238
|
-
const resolved = await Promise.all(routePromises);
|
|
24261
|
+
routePromises.push($c16168a9c28ae4fd$export$2becd43da9d21f73(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, allowList, feeEstimates, balanceRequirements));
|
|
24262
|
+
const resolved = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to resolve all routes", Promise.all(routePromises));
|
|
24239
24263
|
let bridgeFundingStep;
|
|
24240
24264
|
let swapFundingSteps = [];
|
|
24241
24265
|
let onRampFundingStep;
|
|
@@ -24302,26 +24326,31 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
24302
24326
|
};
|
|
24303
24327
|
|
|
24304
24328
|
|
|
24329
|
+
|
|
24305
24330
|
const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (config, provider, itemRequirements, transactionOrGasAmount)=>{
|
|
24306
24331
|
const ownerAddress = await provider.getSigner().getAddress();
|
|
24307
24332
|
let aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(itemRequirements);
|
|
24308
|
-
const
|
|
24309
|
-
const
|
|
24310
|
-
const
|
|
24311
|
-
|
|
24333
|
+
const erc20AllowancePromise = ($fc8b338399d890f3$export$d93c00812189e36)(provider, ownerAddress, aggregatedItems);
|
|
24334
|
+
const erc721AllowancePromise = ($35c3fc7013888ba5$export$be546c525d418988)(provider, ownerAddress, aggregatedItems);
|
|
24335
|
+
const resolvedAllowances = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to calculate token allowances", Promise.all([
|
|
24336
|
+
erc20AllowancePromise,
|
|
24337
|
+
erc721AllowancePromise
|
|
24338
|
+
]));
|
|
24339
|
+
const aggregatedAllowances = ($ddc6bcd0896481e5$export$2fbfa41a4de56a89)(resolvedAllowances[0], resolvedAllowances[1]);
|
|
24340
|
+
const gasItem = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to run gas calculator", ($7d1bfafb81e64d74$export$3a4140bd9e983e4e)(provider, aggregatedAllowances, transactionOrGasAmount));
|
|
24312
24341
|
if (gasItem !== null) {
|
|
24313
24342
|
aggregatedItems.push(gasItem);
|
|
24314
24343
|
aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(aggregatedItems);
|
|
24315
24344
|
}
|
|
24316
|
-
const balanceCheckResult = await ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems);
|
|
24345
|
+
const balanceCheckResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to run balance checks", ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems));
|
|
24317
24346
|
const { sufficient: sufficient } = balanceCheckResult;
|
|
24318
24347
|
const transactionRequirements = balanceCheckResult.balanceRequirements;
|
|
24319
24348
|
if (sufficient) return {
|
|
24320
24349
|
sufficient: sufficient,
|
|
24321
24350
|
transactionRequirements: transactionRequirements
|
|
24322
24351
|
};
|
|
24323
|
-
const availableRoutingOptions = await ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider);
|
|
24324
|
-
const routingOutcome = await ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions);
|
|
24352
|
+
const availableRoutingOptions = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch available routing options", ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider));
|
|
24353
|
+
const routingOutcome = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time to run the routing calculator", ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions));
|
|
24325
24354
|
return {
|
|
24326
24355
|
sufficient: sufficient,
|
|
24327
24356
|
transactionRequirements: transactionRequirements,
|
|
@@ -24504,6 +24533,7 @@ const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimal
|
|
|
24504
24533
|
};
|
|
24505
24534
|
|
|
24506
24535
|
|
|
24536
|
+
|
|
24507
24537
|
const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
|
|
24508
24538
|
switch(type){
|
|
24509
24539
|
case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
|
|
@@ -24542,8 +24572,8 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
24542
24572
|
if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were provided to the orders array. Please provide at least one order.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
|
|
24543
24573
|
const { id: id, takerFees: takerFees } = orders[0];
|
|
24544
24574
|
try {
|
|
24545
|
-
orderbook =
|
|
24546
|
-
order = await orderbook.getListing(id);
|
|
24575
|
+
orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
24576
|
+
order = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch the listing from the orderbook", orderbook.getListing(id));
|
|
24547
24577
|
const { seaportContractAddress: seaportContractAddress } = orderbook.config();
|
|
24548
24578
|
spenderAddress = seaportContractAddress;
|
|
24549
24579
|
} catch (err) {
|
|
@@ -24560,23 +24590,34 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
24560
24590
|
let decimals = 18;
|
|
24561
24591
|
if (order.result.buy[0].type === "ERC20") {
|
|
24562
24592
|
const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
|
|
24563
|
-
decimals = await tokenContract.decimals();
|
|
24593
|
+
decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", tokenContract.decimals());
|
|
24564
24594
|
}
|
|
24565
24595
|
let fees = [];
|
|
24566
24596
|
if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
|
|
24567
24597
|
let unsignedApprovalTransactions = [];
|
|
24568
24598
|
let unsignedFulfillmentTransactions = [];
|
|
24569
24599
|
let orderActions = [];
|
|
24600
|
+
const fulfillOrderStartTime = performance.now();
|
|
24570
24601
|
try {
|
|
24571
|
-
const fulfillerAddress = await provider.getSigner().getAddress();
|
|
24572
|
-
const { actions: actions } = await orderbook.fulfillOrder(id, fulfillerAddress, fees);
|
|
24602
|
+
const fulfillerAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
|
|
24603
|
+
const { actions: actions } = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to call fulfillOrder from the orderbook", orderbook.fulfillOrder(id, fulfillerAddress, fees));
|
|
24573
24604
|
orderActions = actions;
|
|
24574
|
-
unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
|
|
24575
|
-
} catch
|
|
24576
|
-
|
|
24605
|
+
unsignedApprovalTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned approval transactions", (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions));
|
|
24606
|
+
} catch (err) {
|
|
24607
|
+
const elapsedTimeInSeconds = (performance.now() - fulfillOrderStartTime) / 1000;
|
|
24608
|
+
($458d407830d66110$export$e6a390ea6399b7d8)(config, "Time to call fulfillOrder from the orderbook", elapsedTimeInSeconds);
|
|
24609
|
+
if (err.message.includes((OrderStatusName$1).EXPIRED)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Order is expired", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_EXPIRED_ERROR, {
|
|
24610
|
+
orderId: id
|
|
24611
|
+
});
|
|
24612
|
+
// The balances error will be handled by bulk order fulfillment but for now we
|
|
24613
|
+
// need to assert on this string to check that the error is not a balances error
|
|
24614
|
+
if (!err.message.includes("The fulfiller does not have the balances needed to fulfill")) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error occurred while trying to fulfill the order", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR, {
|
|
24615
|
+
orderId: id,
|
|
24616
|
+
message: err.message
|
|
24617
|
+
});
|
|
24577
24618
|
}
|
|
24578
24619
|
try {
|
|
24579
|
-
unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
|
|
24620
|
+
unsignedFulfillmentTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned fulfillment transactions", (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions));
|
|
24580
24621
|
} catch {
|
|
24581
24622
|
// if cannot estimate gas then silently continue and use gas limit in smartCheckout
|
|
24582
24623
|
// but get the fulfillment transactions after they have approved the spending
|
|
@@ -24608,7 +24649,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
24608
24649
|
const itemRequirements = [
|
|
24609
24650
|
$64863c39386de592$export$4249179755829904(type, contractAddress, amount, spenderAddress)
|
|
24610
24651
|
];
|
|
24611
|
-
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions));
|
|
24652
|
+
const smartCheckoutResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time running smart checkout", ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions)));
|
|
24612
24653
|
if (smartCheckoutResult.sufficient) {
|
|
24613
24654
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
|
|
24614
24655
|
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
@@ -24650,15 +24691,16 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
24650
24691
|
|
|
24651
24692
|
|
|
24652
24693
|
|
|
24694
|
+
|
|
24653
24695
|
const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
|
|
24654
24696
|
let unsignedCancelOrderTransaction;
|
|
24655
24697
|
if (orderIds.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orderIds were provided to the orderIds array. Please provide at least one orderId.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR);
|
|
24656
24698
|
// Update this when bulk cancel is supported
|
|
24657
24699
|
const orderId = orderIds[0];
|
|
24658
24700
|
try {
|
|
24659
|
-
const offererAddress = await provider.getSigner().getAddress();
|
|
24660
|
-
const orderbook =
|
|
24661
|
-
const cancelOrderResponse = await orderbook.cancelOrder(orderId, offererAddress);
|
|
24701
|
+
const offererAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
|
|
24702
|
+
const orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
24703
|
+
const cancelOrderResponse = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the cancel order from the orderbook", orderbook.cancelOrder(orderId, offererAddress));
|
|
24662
24704
|
unsignedCancelOrderTransaction = cancelOrderResponse.unsignedCancelOrderTransaction;
|
|
24663
24705
|
} catch (err) {
|
|
24664
24706
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while cancelling the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR, {
|
|
@@ -24691,6 +24733,7 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
24691
24733
|
|
|
24692
24734
|
|
|
24693
24735
|
|
|
24736
|
+
|
|
24694
24737
|
const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
|
|
24695
24738
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
|
|
24696
24739
|
id: id,
|
|
@@ -24719,15 +24762,15 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
24719
24762
|
if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
|
|
24720
24763
|
// get this from the allowed list
|
|
24721
24764
|
const buyTokenContract = new (Contract$1)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
|
|
24722
|
-
decimals = await buyTokenContract.decimals();
|
|
24765
|
+
decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", buyTokenContract.decimals());
|
|
24723
24766
|
}
|
|
24724
24767
|
const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
|
|
24725
24768
|
try {
|
|
24726
|
-
const walletAddress = await provider.getSigner().getAddress();
|
|
24727
|
-
orderbook =
|
|
24769
|
+
const walletAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
|
|
24770
|
+
orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
24728
24771
|
const { seaportContractAddress: seaportContractAddress } = orderbook.config();
|
|
24729
24772
|
spenderAddress = seaportContractAddress;
|
|
24730
|
-
listing = await orderbook.prepareListing({
|
|
24773
|
+
listing = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to prepare the listing from the orderbook", orderbook.prepareListing({
|
|
24731
24774
|
makerAddress: walletAddress,
|
|
24732
24775
|
buy: buyTokenOrNative,
|
|
24733
24776
|
sell: {
|
|
@@ -24735,7 +24778,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
24735
24778
|
contractAddress: sellToken.collectionAddress,
|
|
24736
24779
|
tokenId: sellToken.id
|
|
24737
24780
|
}
|
|
24738
|
-
});
|
|
24781
|
+
}));
|
|
24739
24782
|
} catch (err) {
|
|
24740
24783
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while preparing the listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR, {
|
|
24741
24784
|
message: err.message,
|
|
@@ -24746,13 +24789,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
24746
24789
|
const itemRequirements = [
|
|
24747
24790
|
$9085b221b72ac69e$export$af768ccdf17d5c04(sellToken.id, sellToken.collectionAddress, spenderAddress)
|
|
24748
24791
|
];
|
|
24749
|
-
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
|
|
24792
|
+
const smartCheckoutResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time running smart checkout", ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
|
|
24750
24793
|
type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
|
|
24751
24794
|
gasToken: {
|
|
24752
24795
|
type: ($4b58188d47aafe8d$export$537fa3efd10ed435).NATIVE,
|
|
24753
24796
|
limit: (BigNumber$1).from((constants).estimatedFulfillmentGasGwei)
|
|
24754
24797
|
}
|
|
24755
|
-
});
|
|
24798
|
+
}));
|
|
24756
24799
|
if (smartCheckoutResult.sufficient) {
|
|
24757
24800
|
const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
|
|
24758
24801
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
25
25
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.
|
|
28
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.13";
|
|
29
29
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30
30
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31
31
|
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.27.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.27.13',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|