@imtbl/sdk 0.27.11 → 0.27.12
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.js +103 -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 +113 -79
- package/dist/index.d.ts +52 -32
- package/dist/index.js +113 -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/index.js
CHANGED
|
@@ -3610,7 +3610,7 @@ class MultiRollupApiClients {
|
|
|
3610
3610
|
}
|
|
3611
3611
|
|
|
3612
3612
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3613
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.
|
|
3613
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.12' };
|
|
3614
3614
|
const createConfig = ({ basePath, headers, }) => {
|
|
3615
3615
|
if (!basePath.trim()) {
|
|
3616
3616
|
throw Error('basePath can not be empty');
|
|
@@ -3670,7 +3670,7 @@ class APIError extends Error {
|
|
|
3670
3670
|
|
|
3671
3671
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3672
3672
|
const defaultHeaders = {
|
|
3673
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.
|
|
3673
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.12',
|
|
3674
3674
|
};
|
|
3675
3675
|
/**
|
|
3676
3676
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4062,14 +4062,14 @@ class BlockchainData {
|
|
|
4062
4062
|
var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
4063
4063
|
__proto__: null,
|
|
4064
4064
|
APIError: APIError,
|
|
4065
|
-
|
|
4065
|
+
ActivitiesTypes: activitiesApiTypes,
|
|
4066
4066
|
BlockchainData: BlockchainData,
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4067
|
+
ChainsTypes: chainsApiTypes,
|
|
4068
|
+
CollectionsTypes: collectionsApiTypes,
|
|
4069
|
+
MetadataTypes: metadataApiTypes,
|
|
4070
|
+
NFTOwnersTypes: nftOwnersApiTypes,
|
|
4071
|
+
NFTsTypes: nftsApiTypes,
|
|
4072
|
+
TokensTypes: tokensApiTypes
|
|
4073
4073
|
});
|
|
4074
4074
|
|
|
4075
4075
|
/**
|
|
@@ -4081,7 +4081,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4081
4081
|
chainID,
|
|
4082
4082
|
coreContractAddress,
|
|
4083
4083
|
registrationContractAddress,
|
|
4084
|
-
sdkVersion: 'ts-immutable-sdk-0.27.
|
|
4084
|
+
sdkVersion: 'ts-immutable-sdk-0.27.12',
|
|
4085
4085
|
});
|
|
4086
4086
|
/**
|
|
4087
4087
|
* Sets `sdkVersion` at the time of build
|
|
@@ -11223,7 +11223,7 @@ class OrdersService {
|
|
|
11223
11223
|
* @returns ListListingsResult OK response.
|
|
11224
11224
|
* @throws ApiError
|
|
11225
11225
|
*/
|
|
11226
|
-
listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
11226
|
+
listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
11227
11227
|
return this.httpRequest.request({
|
|
11228
11228
|
method: 'GET',
|
|
11229
11229
|
url: '/v1/chains/{chain_name}/orders/listings',
|
|
@@ -11235,6 +11235,7 @@ class OrdersService {
|
|
|
11235
11235
|
'sell_item_contract_address': sellItemContractAddress,
|
|
11236
11236
|
'buy_item_contract_address': buyItemContractAddress,
|
|
11237
11237
|
'sell_item_token_id': sellItemTokenId,
|
|
11238
|
+
'from_updated_at': fromUpdatedAt,
|
|
11238
11239
|
'page_size': pageSize,
|
|
11239
11240
|
'sort_by': sortBy,
|
|
11240
11241
|
'sort_direction': sortDirection,
|
|
@@ -11318,7 +11319,7 @@ class OrdersService {
|
|
|
11318
11319
|
* @returns ListTradeResult OK response.
|
|
11319
11320
|
* @throws ApiError
|
|
11320
11321
|
*/
|
|
11321
|
-
listTrades({ chainName, accountAddress, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
11322
|
+
listTrades({ chainName, accountAddress, fromIndexedAt, pageSize, sortBy, sortDirection, pageCursor, }) {
|
|
11322
11323
|
return this.httpRequest.request({
|
|
11323
11324
|
method: 'GET',
|
|
11324
11325
|
url: '/v1/chains/{chain_name}/trades',
|
|
@@ -11327,6 +11328,7 @@ class OrdersService {
|
|
|
11327
11328
|
},
|
|
11328
11329
|
query: {
|
|
11329
11330
|
'account_address': accountAddress,
|
|
11331
|
+
'from_indexed_at': fromIndexedAt,
|
|
11330
11332
|
'page_size': pageSize,
|
|
11331
11333
|
'sort_by': sortBy,
|
|
11332
11334
|
'sort_direction': sortDirection,
|
|
@@ -11392,6 +11394,16 @@ var CancelledOrderStatus;
|
|
|
11392
11394
|
})(CancelledOrderStatus.cancellation_type || (CancelledOrderStatus.cancellation_type = {}));
|
|
11393
11395
|
})(CancelledOrderStatus || (CancelledOrderStatus = {}));
|
|
11394
11396
|
|
|
11397
|
+
/* istanbul ignore file */
|
|
11398
|
+
/* tslint:disable */
|
|
11399
|
+
/* eslint-disable */
|
|
11400
|
+
var FailedOrderCancellation;
|
|
11401
|
+
(function (FailedOrderCancellation) {
|
|
11402
|
+
(function (reason_code) {
|
|
11403
|
+
reason_code["ALREADY_FILLED"] = "ALREADY_FILLED";
|
|
11404
|
+
})(FailedOrderCancellation.reason_code || (FailedOrderCancellation.reason_code = {}));
|
|
11405
|
+
})(FailedOrderCancellation || (FailedOrderCancellation = {}));
|
|
11406
|
+
|
|
11395
11407
|
/* istanbul ignore file */
|
|
11396
11408
|
/* tslint:disable */
|
|
11397
11409
|
/* eslint-disable */
|
|
@@ -30071,6 +30083,20 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
|
|
|
30071
30083
|
|
|
30072
30084
|
|
|
30073
30085
|
|
|
30086
|
+
const $458d407830d66110$export$e6a390ea6399b7d8 = (config, debugString, seconds)=>{
|
|
30087
|
+
// eslint-disable-next-line no-console
|
|
30088
|
+
if (!config.isProduction) console.debug(debugString, seconds);
|
|
30089
|
+
};
|
|
30090
|
+
const $458d407830d66110$export$5280dbcb91c8b391 = async (config, debugString, promise)=>{
|
|
30091
|
+
const startTime = performance.now();
|
|
30092
|
+
const result = await promise;
|
|
30093
|
+
const endTime = performance.now();
|
|
30094
|
+
const elapsedTimeInSeconds = (endTime - startTime) / 1000;
|
|
30095
|
+
$458d407830d66110$export$e6a390ea6399b7d8(config, debugString, elapsedTimeInSeconds);
|
|
30096
|
+
return result;
|
|
30097
|
+
};
|
|
30098
|
+
|
|
30099
|
+
|
|
30074
30100
|
const $1564e43dde50bb61$export$df96cd8d56be0ab1 = async (config, web3Provider, walletAddress)=>await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
30075
30101
|
const networkInfo = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(config, web3Provider);
|
|
30076
30102
|
if (!networkInfo.isSupported) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${networkInfo.chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR, {
|
|
@@ -30225,12 +30251,12 @@ const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, web3Provider, w
|
|
|
30225
30251
|
// Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
|
|
30226
30252
|
// is done.
|
|
30227
30253
|
const isL1Chain = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config) === chainId;
|
|
30228
|
-
return
|
|
30254
|
+
return ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using blockscout for ${chainId}`, $1564e43dde50bb61$export$8c978679845804d4(walletAddress, chainId, isL1Chain ? tokens : []));
|
|
30229
30255
|
}
|
|
30230
30256
|
// This fallback to use ERC20s calls which is a best effort solution
|
|
30231
30257
|
// Fails in fetching data from the RCP calls might result in some
|
|
30232
30258
|
// missing data.
|
|
30233
|
-
return await $1564e43dde50bb61$export$a3238cee431627c6(config, web3Provider, walletAddress, tokens);
|
|
30259
|
+
return await ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using RPC for ${chainId}`, $1564e43dde50bb61$export$a3238cee431627c6(config, web3Provider, walletAddress, tokens));
|
|
30234
30260
|
};
|
|
30235
30261
|
|
|
30236
30262
|
|
|
@@ -30471,7 +30497,7 @@ async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
|
|
|
30471
30497
|
overrides: dexConfig?.overrides
|
|
30472
30498
|
});
|
|
30473
30499
|
}
|
|
30474
|
-
|
|
30500
|
+
function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
|
|
30475
30501
|
return new (Orderbook)({
|
|
30476
30502
|
baseConfig: {
|
|
30477
30503
|
environment: config.environment
|
|
@@ -31272,8 +31298,8 @@ const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=
|
|
|
31272
31298
|
|
|
31273
31299
|
|
|
31274
31300
|
|
|
31275
|
-
const $1fda5c40669a566d$export$
|
|
31276
|
-
const $1fda5c40669a566d$export$
|
|
31301
|
+
const $1fda5c40669a566d$export$5d79dcabf4595ae0 = async ()=>true;
|
|
31302
|
+
const $1fda5c40669a566d$export$2c2bcd6e0d9a9969 = async (config)=>{
|
|
31277
31303
|
const availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(config.isDevelopment, config.isProduction);
|
|
31278
31304
|
try {
|
|
31279
31305
|
return await availability.checkDexAvailability();
|
|
@@ -31294,18 +31320,18 @@ const $7f2e17f026d4fc8d$export$86d9f998ddda013e = async (config, provider)=>{
|
|
|
31294
31320
|
const geoBlockingChecks = [];
|
|
31295
31321
|
if (availableRoutingOptions.onRamp) geoBlockingChecks.push({
|
|
31296
31322
|
id: "onRamp",
|
|
31297
|
-
promise: ($1fda5c40669a566d$export$
|
|
31323
|
+
promise: ($1fda5c40669a566d$export$5d79dcabf4595ae0)()
|
|
31298
31324
|
});
|
|
31299
31325
|
if (availableRoutingOptions.swap) geoBlockingChecks.push({
|
|
31300
31326
|
id: "swap",
|
|
31301
|
-
promise: ($1fda5c40669a566d$export$
|
|
31327
|
+
promise: ($1fda5c40669a566d$export$2c2bcd6e0d9a9969)(config)
|
|
31302
31328
|
});
|
|
31303
31329
|
if (geoBlockingChecks.length > 0) {
|
|
31304
31330
|
const promises = geoBlockingChecks.map((geoBlockingCheck)=>geoBlockingCheck.promise);
|
|
31305
31331
|
const geoBlockingStatus = await Promise.allSettled(promises);
|
|
31306
31332
|
geoBlockingStatus.forEach((result, index)=>{
|
|
31307
31333
|
const statusId = geoBlockingChecks[index].id;
|
|
31308
|
-
availableRoutingOptions[statusId] = availableRoutingOptions[statusId] && result.status === "fulfilled" &&
|
|
31334
|
+
availableRoutingOptions[statusId] = availableRoutingOptions[statusId] && result.status === "fulfilled" && result.value;
|
|
31309
31335
|
});
|
|
31310
31336
|
}
|
|
31311
31337
|
// Bridge not available if passport provider
|
|
@@ -31412,7 +31438,7 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
|
|
|
31412
31438
|
}
|
|
31413
31439
|
// Resolve all the quotes and link them back to the swappable token
|
|
31414
31440
|
// The swappable token array is in the same position in the array as the quote in the promise array
|
|
31415
|
-
const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
|
|
31441
|
+
const dexTransactionResponse = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to resolve swap quotes from the dex", Promise.allSettled(dexTransactionResponsePromises));
|
|
31416
31442
|
dexTransactionResponse.forEach((response, index)=>{
|
|
31417
31443
|
if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
|
|
31418
31444
|
const swappableToken = fromToken[index];
|
|
@@ -31429,15 +31455,6 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
|
|
|
31429
31455
|
};
|
|
31430
31456
|
|
|
31431
31457
|
|
|
31432
|
-
const $3ee85f12225c19f3$export$fb80fe94a81a3132 = async (config, dexQuoteCache, walletAddress, requiredToken, swappableTokens)=>{
|
|
31433
|
-
const dexQuotes = dexQuoteCache.get(requiredToken.address);
|
|
31434
|
-
if (dexQuotes && dexQuotes.size > 0) return dexQuotes;
|
|
31435
|
-
const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
|
|
31436
|
-
dexQuoteCache.set(requiredToken.address, quotes);
|
|
31437
|
-
return quotes;
|
|
31438
|
-
};
|
|
31439
|
-
|
|
31440
|
-
|
|
31441
31458
|
const $91807edfd7057288$var$constructFees = (approvalGasFees, swapGasFees, swapFees)=>{
|
|
31442
31459
|
let approvalGasFeeAmount = (BigNumber$1).from(0);
|
|
31443
31460
|
let approvalGasFeeFormatted = "0";
|
|
@@ -31565,11 +31582,17 @@ const $91807edfd7057288$export$7b6318fc1a8067b3 = (l2Balances, approval)=>{
|
|
|
31565
31582
|
approvalGasTokenAddress: approvalGasTokenAddress
|
|
31566
31583
|
};
|
|
31567
31584
|
};
|
|
31568
|
-
const $91807edfd7057288$export$38077235fe748d40 = (l2Balances,
|
|
31585
|
+
const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, approvalFees, swapGasFees, swapFees, tokenBeingSwapped)=>{
|
|
31569
31586
|
// Set up a map of token addresses to amounts for each of the swap fees
|
|
31570
31587
|
const feeMap = new Map();
|
|
31571
31588
|
// Add the approval fee to list of fees
|
|
31572
31589
|
if (approvalFees.approvalGasTokenAddress !== "") feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
|
|
31590
|
+
// Add the swap gas fee to list of fees
|
|
31591
|
+
if (swapGasFees) {
|
|
31592
|
+
const fee = feeMap.get(swapGasFees.token.address);
|
|
31593
|
+
if (fee) feeMap.set(swapGasFees.token.address, fee.add(swapGasFees.value));
|
|
31594
|
+
else feeMap.set(swapGasFees.token.address, swapGasFees.value);
|
|
31595
|
+
}
|
|
31573
31596
|
// Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
|
|
31574
31597
|
if (tokenBeingSwapped) {
|
|
31575
31598
|
const fee = feeMap.get(tokenBeingSwapped.address);
|
|
@@ -31618,7 +31641,7 @@ const $91807edfd7057288$export$567a0c83c08c514b = (l2balance, balanceRequirement
|
|
|
31618
31641
|
// that is going to be swapped from another item requirement then return true
|
|
31619
31642
|
return remainingBalance.gte(amountBeingSwapped);
|
|
31620
31643
|
};
|
|
31621
|
-
const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions,
|
|
31644
|
+
const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens, balanceRequirements)=>{
|
|
31622
31645
|
const fundingSteps = [];
|
|
31623
31646
|
if (!availableRoutingOptions.swap) return fundingSteps;
|
|
31624
31647
|
if (swappableTokens.length === 0) return fundingSteps;
|
|
@@ -31629,7 +31652,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
31629
31652
|
if (!l2TokenBalanceResult) return fundingSteps;
|
|
31630
31653
|
const l2Balances = l2TokenBalanceResult.balances;
|
|
31631
31654
|
if (l2Balances.length === 0) return fundingSteps;
|
|
31632
|
-
const quotes = await ($
|
|
31655
|
+
const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
|
|
31633
31656
|
const quoteTokenAddresses = Array.from(quotes.keys());
|
|
31634
31657
|
for (const quoteTokenAddress of quoteTokenAddresses){
|
|
31635
31658
|
const quote = quotes.get(quoteTokenAddress);
|
|
@@ -31646,7 +31669,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
31646
31669
|
// If user does not have enough to cover approval fees then continue
|
|
31647
31670
|
if (!approvalFees.sufficient) continue;
|
|
31648
31671
|
// If user does not have enough to cover swap fees then continue
|
|
31649
|
-
if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, quote.quote.fees,
|
|
31672
|
+
if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, approvalFees, quote.swap, quote.quote.fees, {
|
|
31650
31673
|
amount: amountOfQuoteTokenRequired.value,
|
|
31651
31674
|
address: quoteTokenAddress
|
|
31652
31675
|
})) continue;
|
|
@@ -32051,13 +32074,14 @@ const $7500587317643fc8$export$c3e193fd573f1a94 = async (config, swappableTokens
|
|
|
32051
32074
|
|
|
32052
32075
|
|
|
32053
32076
|
|
|
32054
|
-
|
|
32077
|
+
|
|
32078
|
+
const $d54df4a884f14123$export$d46f2133747ffd93 = async (config, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens)=>{
|
|
32055
32079
|
const filteredSwappableTokensAddresses = [];
|
|
32056
32080
|
for (const token of filteredSwappableTokens){
|
|
32057
32081
|
if (!token.address) continue;
|
|
32058
32082
|
filteredSwappableTokensAddresses.push(token.address);
|
|
32059
32083
|
}
|
|
32060
|
-
const dexQuotes = await ($
|
|
32084
|
+
const dexQuotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), ownerAddress, {
|
|
32061
32085
|
address: requiredTokenAddress,
|
|
32062
32086
|
amount: insufficientRequirement.delta.balance
|
|
32063
32087
|
}, filteredSwappableTokensAddresses);
|
|
@@ -32167,7 +32191,7 @@ const $afd57acae9471ac5$export$d9b96654eebdaf2a = (bridgeFundingSteps, swapFundi
|
|
|
32167
32191
|
}
|
|
32168
32192
|
return bridgeAndSwapRoutes;
|
|
32169
32193
|
};
|
|
32170
|
-
const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
32194
|
+
const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, feeEstimates, tokenBalances, bridgeableTokens, swappableTokens, balanceRequirements)=>{
|
|
32171
32195
|
const { l1balances: l1balances, l2balances: l2balances } = ($7bb5af1d8b5d9127$export$8280985cc3da7882)(config, tokenBalances);
|
|
32172
32196
|
const requiredTokenAddress = insufficientRequirement.required.token.address;
|
|
32173
32197
|
if ($afd57acae9471ac5$export$b94e88f4f8805f71(bridgeableTokens, swappableTokens, l1balances, l2balances, availableRoutingOptions, requiredTokenAddress)) return [];
|
|
@@ -32178,7 +32202,7 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
|
|
|
32178
32202
|
const filteredSwappableTokens = $afd57acae9471ac5$export$ed7c59bd8d1bb5a7(requiredTokenAddress, bridgeableTokens, swappableTokens, l1tol2Addresses);
|
|
32179
32203
|
if (filteredSwappableTokens.length === 0) return [];
|
|
32180
32204
|
// Fetch all the dex quotes from the list of swappable tokens
|
|
32181
|
-
const dexQuotes = await ($d54df4a884f14123$export$d46f2133747ffd93)(config,
|
|
32205
|
+
const dexQuotes = await ($d54df4a884f14123$export$d46f2133747ffd93)(config, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens);
|
|
32182
32206
|
// Construct bridge requirements based on L2 balances, slippage and swap fees
|
|
32183
32207
|
const bridgeRequirements = ($62e968a3dd87940e$export$df667c749c93b110)(dexQuotes, l1balances, l2balances, l1tol2Addresses, balanceRequirements);
|
|
32184
32208
|
if (bridgeRequirements.length === 0) return [];
|
|
@@ -32221,7 +32245,7 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
|
|
|
32221
32245
|
// Modify the users L2 balance to include the amount as if the user successfully bridged
|
|
32222
32246
|
const modifiedTokenBalances = $afd57acae9471ac5$var$modifyTokenBalancesWithBridgedAmount(config, tokenBalances, l2balances, bridgedTokens, swappableTokens);
|
|
32223
32247
|
// Call the swap route with the faked bridged balances
|
|
32224
|
-
const swapRoutes = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions,
|
|
32248
|
+
const swapRoutes = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, ownerAddress, insufficientRequirement, modifiedTokenBalances, swappableTokensAfterBridging, balanceRequirements);
|
|
32225
32249
|
if (!swapRoutes) return [];
|
|
32226
32250
|
const originalBalanceSwapRoutes = $afd57acae9471ac5$export$1fc63300bde5e690(tokenBalances, swapRoutes);
|
|
32227
32251
|
return $afd57acae9471ac5$export$d9b96654eebdaf2a(bridgeResults, originalBalanceSwapRoutes, l1tol2Addresses);
|
|
@@ -32263,6 +32287,7 @@ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutin
|
|
|
32263
32287
|
|
|
32264
32288
|
|
|
32265
32289
|
|
|
32290
|
+
|
|
32266
32291
|
const $c16168a9c28ae4fd$var$hasAvailableRoutingOptions = (availableRoutingOptions)=>availableRoutingOptions.bridge || availableRoutingOptions.swap || availableRoutingOptions.onRamp;
|
|
32267
32292
|
const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
32268
32293
|
let insufficientBalanceCount = 0;
|
|
@@ -32286,7 +32311,7 @@ const $c16168a9c28ae4fd$export$ab86023c267660 = async (config, readOnlyProviders
|
|
|
32286
32311
|
if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, bridgeRequirement, tokenBalances, feeEstimates);
|
|
32287
32312
|
return bridgeFundingStep;
|
|
32288
32313
|
};
|
|
32289
|
-
const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement,
|
|
32314
|
+
const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, swapTokenAllowList, balanceRequirements)=>{
|
|
32290
32315
|
const fundingSteps = [];
|
|
32291
32316
|
if (!availableRoutingOptions.swap) return fundingSteps;
|
|
32292
32317
|
if (insufficientRequirement === undefined) return fundingSteps;
|
|
@@ -32297,9 +32322,9 @@ const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutin
|
|
|
32297
32322
|
if (swapTokenAllowList.length === 0) return fundingSteps;
|
|
32298
32323
|
const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
|
|
32299
32324
|
if (swappableTokens.length === 0) return fundingSteps;
|
|
32300
|
-
return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions,
|
|
32325
|
+
return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens, balanceRequirements);
|
|
32301
32326
|
};
|
|
32302
|
-
const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
32327
|
+
const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, tokenAllowList, feeEstimates, balanceRequirements)=>{
|
|
32303
32328
|
if (!insufficientRequirement) return [];
|
|
32304
32329
|
const l1balancesResult = tokenBalances.get(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
|
|
32305
32330
|
const l2balancesResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
@@ -32317,7 +32342,7 @@ const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProvide
|
|
|
32317
32342
|
});
|
|
32318
32343
|
const swapTokenAllowList = tokenAllowList?.swap ?? [];
|
|
32319
32344
|
if (insufficientRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE && insufficientRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return [];
|
|
32320
|
-
const routes = await ($afd57acae9471ac5$export$f95ed27e871fe308)(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
32345
|
+
const routes = await ($afd57acae9471ac5$export$f95ed27e871fe308)(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, feeEstimates, tokenBalances, bridgeableL1Addresses, swapTokenAllowList, balanceRequirements);
|
|
32321
32346
|
return routes;
|
|
32322
32347
|
};
|
|
32323
32348
|
const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
|
|
@@ -32339,20 +32364,18 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
32339
32364
|
message: err.message
|
|
32340
32365
|
});
|
|
32341
32366
|
}
|
|
32342
|
-
const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
|
|
32343
|
-
const allowList = await ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions);
|
|
32344
|
-
//
|
|
32367
|
+
const tokenBalances = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get token balances inside router", ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions));
|
|
32368
|
+
const allowList = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get routing allowlist", ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions));
|
|
32369
|
+
// Fee estimate cache
|
|
32345
32370
|
const feeEstimates = new Map();
|
|
32346
|
-
// Dex quotes cache
|
|
32347
|
-
const dexQuoteCache = new Map();
|
|
32348
32371
|
// Ensures only 1 balance requirement is insufficient
|
|
32349
32372
|
const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
|
|
32350
32373
|
const routePromises = [];
|
|
32351
32374
|
routePromises.push($c16168a9c28ae4fd$export$ab86023c267660(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, feeEstimates));
|
|
32352
|
-
routePromises.push($c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement,
|
|
32375
|
+
routePromises.push($c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, allowList.swap, balanceRequirements));
|
|
32353
32376
|
routePromises.push($c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement));
|
|
32354
|
-
routePromises.push($c16168a9c28ae4fd$export$2becd43da9d21f73(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement,
|
|
32355
|
-
const resolved = await Promise.all(routePromises);
|
|
32377
|
+
routePromises.push($c16168a9c28ae4fd$export$2becd43da9d21f73(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, allowList, feeEstimates, balanceRequirements));
|
|
32378
|
+
const resolved = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to resolve all routes", Promise.all(routePromises));
|
|
32356
32379
|
let bridgeFundingStep;
|
|
32357
32380
|
let swapFundingSteps = [];
|
|
32358
32381
|
let onRampFundingStep;
|
|
@@ -32419,26 +32442,31 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
32419
32442
|
};
|
|
32420
32443
|
|
|
32421
32444
|
|
|
32445
|
+
|
|
32422
32446
|
const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (config, provider, itemRequirements, transactionOrGasAmount)=>{
|
|
32423
32447
|
const ownerAddress = await provider.getSigner().getAddress();
|
|
32424
32448
|
let aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(itemRequirements);
|
|
32425
|
-
const
|
|
32426
|
-
const
|
|
32427
|
-
const
|
|
32428
|
-
|
|
32449
|
+
const erc20AllowancePromise = ($fc8b338399d890f3$export$d93c00812189e36)(provider, ownerAddress, aggregatedItems);
|
|
32450
|
+
const erc721AllowancePromise = ($35c3fc7013888ba5$export$be546c525d418988)(provider, ownerAddress, aggregatedItems);
|
|
32451
|
+
const resolvedAllowances = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to calculate token allowances", Promise.all([
|
|
32452
|
+
erc20AllowancePromise,
|
|
32453
|
+
erc721AllowancePromise
|
|
32454
|
+
]));
|
|
32455
|
+
const aggregatedAllowances = ($ddc6bcd0896481e5$export$2fbfa41a4de56a89)(resolvedAllowances[0], resolvedAllowances[1]);
|
|
32456
|
+
const gasItem = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to run gas calculator", ($7d1bfafb81e64d74$export$3a4140bd9e983e4e)(provider, aggregatedAllowances, transactionOrGasAmount));
|
|
32429
32457
|
if (gasItem !== null) {
|
|
32430
32458
|
aggregatedItems.push(gasItem);
|
|
32431
32459
|
aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(aggregatedItems);
|
|
32432
32460
|
}
|
|
32433
|
-
const balanceCheckResult = await ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems);
|
|
32461
|
+
const balanceCheckResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to run balance checks", ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems));
|
|
32434
32462
|
const { sufficient: sufficient } = balanceCheckResult;
|
|
32435
32463
|
const transactionRequirements = balanceCheckResult.balanceRequirements;
|
|
32436
32464
|
if (sufficient) return {
|
|
32437
32465
|
sufficient: sufficient,
|
|
32438
32466
|
transactionRequirements: transactionRequirements
|
|
32439
32467
|
};
|
|
32440
|
-
const availableRoutingOptions = await ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider);
|
|
32441
|
-
const routingOutcome = await ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions);
|
|
32468
|
+
const availableRoutingOptions = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch available routing options", ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider));
|
|
32469
|
+
const routingOutcome = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time to run the routing calculator", ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions));
|
|
32442
32470
|
return {
|
|
32443
32471
|
sufficient: sufficient,
|
|
32444
32472
|
transactionRequirements: transactionRequirements,
|
|
@@ -32621,6 +32649,7 @@ const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimal
|
|
|
32621
32649
|
};
|
|
32622
32650
|
|
|
32623
32651
|
|
|
32652
|
+
|
|
32624
32653
|
const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
|
|
32625
32654
|
switch(type){
|
|
32626
32655
|
case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
|
|
@@ -32659,8 +32688,8 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
32659
32688
|
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);
|
|
32660
32689
|
const { id: id, takerFees: takerFees } = orders[0];
|
|
32661
32690
|
try {
|
|
32662
|
-
orderbook =
|
|
32663
|
-
order = await orderbook.getListing(id);
|
|
32691
|
+
orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
32692
|
+
order = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch the listing from the orderbook", orderbook.getListing(id));
|
|
32664
32693
|
const { seaportContractAddress: seaportContractAddress } = orderbook.config();
|
|
32665
32694
|
spenderAddress = seaportContractAddress;
|
|
32666
32695
|
} catch (err) {
|
|
@@ -32677,23 +32706,26 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
32677
32706
|
let decimals = 18;
|
|
32678
32707
|
if (order.result.buy[0].type === "ERC20") {
|
|
32679
32708
|
const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
|
|
32680
|
-
decimals = await tokenContract.decimals();
|
|
32709
|
+
decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", tokenContract.decimals());
|
|
32681
32710
|
}
|
|
32682
32711
|
let fees = [];
|
|
32683
32712
|
if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
|
|
32684
32713
|
let unsignedApprovalTransactions = [];
|
|
32685
32714
|
let unsignedFulfillmentTransactions = [];
|
|
32686
32715
|
let orderActions = [];
|
|
32716
|
+
const fulfillOrderStartTime = new Date().getTime();
|
|
32687
32717
|
try {
|
|
32688
|
-
const fulfillerAddress = await provider.getSigner().getAddress();
|
|
32689
|
-
const { actions: actions } = await orderbook.fulfillOrder(id, fulfillerAddress, fees);
|
|
32718
|
+
const fulfillerAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
|
|
32719
|
+
const { actions: actions } = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to call fulfillOrder from the orderbook", orderbook.fulfillOrder(id, fulfillerAddress, fees));
|
|
32690
32720
|
orderActions = actions;
|
|
32691
|
-
unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
|
|
32692
|
-
} catch
|
|
32693
|
-
|
|
32721
|
+
unsignedApprovalTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned approval transactions", (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions));
|
|
32722
|
+
} catch (err) {
|
|
32723
|
+
// Silently ignore error as this is usually thrown if user does not have enough balance
|
|
32724
|
+
const elapsedTimeInSeconds = (new Date().getTime() - fulfillOrderStartTime) / 1000;
|
|
32725
|
+
($458d407830d66110$export$e6a390ea6399b7d8)(config, "Time to call fulfillOrder from the orderbook", elapsedTimeInSeconds);
|
|
32694
32726
|
}
|
|
32695
32727
|
try {
|
|
32696
|
-
unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
|
|
32728
|
+
unsignedFulfillmentTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned fulfillment transactions", (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions));
|
|
32697
32729
|
} catch {
|
|
32698
32730
|
// if cannot estimate gas then silently continue and use gas limit in smartCheckout
|
|
32699
32731
|
// but get the fulfillment transactions after they have approved the spending
|
|
@@ -32725,7 +32757,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
32725
32757
|
const itemRequirements = [
|
|
32726
32758
|
$64863c39386de592$export$4249179755829904(type, contractAddress, amount, spenderAddress)
|
|
32727
32759
|
];
|
|
32728
|
-
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions));
|
|
32760
|
+
const smartCheckoutResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time running smart checkout", ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions)));
|
|
32729
32761
|
if (smartCheckoutResult.sufficient) {
|
|
32730
32762
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
|
|
32731
32763
|
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
@@ -32767,15 +32799,16 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
32767
32799
|
|
|
32768
32800
|
|
|
32769
32801
|
|
|
32802
|
+
|
|
32770
32803
|
const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
|
|
32771
32804
|
let unsignedCancelOrderTransaction;
|
|
32772
32805
|
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);
|
|
32773
32806
|
// Update this when bulk cancel is supported
|
|
32774
32807
|
const orderId = orderIds[0];
|
|
32775
32808
|
try {
|
|
32776
|
-
const offererAddress = await provider.getSigner().getAddress();
|
|
32777
|
-
const orderbook =
|
|
32778
|
-
const cancelOrderResponse = await orderbook.cancelOrder(orderId, offererAddress);
|
|
32809
|
+
const offererAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
|
|
32810
|
+
const orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
32811
|
+
const cancelOrderResponse = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the cancel order from the orderbook", orderbook.cancelOrder(orderId, offererAddress));
|
|
32779
32812
|
unsignedCancelOrderTransaction = cancelOrderResponse.unsignedCancelOrderTransaction;
|
|
32780
32813
|
} catch (err) {
|
|
32781
32814
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while cancelling the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR, {
|
|
@@ -32808,6 +32841,7 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
32808
32841
|
|
|
32809
32842
|
|
|
32810
32843
|
|
|
32844
|
+
|
|
32811
32845
|
const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
|
|
32812
32846
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
|
|
32813
32847
|
id: id,
|
|
@@ -32836,15 +32870,15 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
32836
32870
|
if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
|
|
32837
32871
|
// get this from the allowed list
|
|
32838
32872
|
const buyTokenContract = new (Contract$1)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
|
|
32839
|
-
decimals = await buyTokenContract.decimals();
|
|
32873
|
+
decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", buyTokenContract.decimals());
|
|
32840
32874
|
}
|
|
32841
32875
|
const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
|
|
32842
32876
|
try {
|
|
32843
|
-
const walletAddress = await provider.getSigner().getAddress();
|
|
32844
|
-
orderbook =
|
|
32877
|
+
const walletAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
|
|
32878
|
+
orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
32845
32879
|
const { seaportContractAddress: seaportContractAddress } = orderbook.config();
|
|
32846
32880
|
spenderAddress = seaportContractAddress;
|
|
32847
|
-
listing = await orderbook.prepareListing({
|
|
32881
|
+
listing = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to prepare the listing from the orderbook", orderbook.prepareListing({
|
|
32848
32882
|
makerAddress: walletAddress,
|
|
32849
32883
|
buy: buyTokenOrNative,
|
|
32850
32884
|
sell: {
|
|
@@ -32852,7 +32886,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
32852
32886
|
contractAddress: sellToken.collectionAddress,
|
|
32853
32887
|
tokenId: sellToken.id
|
|
32854
32888
|
}
|
|
32855
|
-
});
|
|
32889
|
+
}));
|
|
32856
32890
|
} catch (err) {
|
|
32857
32891
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while preparing the listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR, {
|
|
32858
32892
|
message: err.message,
|
|
@@ -32863,13 +32897,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
32863
32897
|
const itemRequirements = [
|
|
32864
32898
|
$9085b221b72ac69e$export$af768ccdf17d5c04(sellToken.id, sellToken.collectionAddress, spenderAddress)
|
|
32865
32899
|
];
|
|
32866
|
-
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
|
|
32900
|
+
const smartCheckoutResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time running smart checkout", ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
|
|
32867
32901
|
type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
|
|
32868
32902
|
gasToken: {
|
|
32869
32903
|
type: ($4b58188d47aafe8d$export$537fa3efd10ed435).NATIVE,
|
|
32870
32904
|
limit: (BigNumber$1).from((constants).estimatedFulfillmentGasGwei)
|
|
32871
32905
|
}
|
|
32872
|
-
});
|
|
32906
|
+
}));
|
|
32873
32907
|
if (smartCheckoutResult.sufficient) {
|
|
32874
32908
|
const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
|
|
32875
32909
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
|
|
@@ -33273,7 +33307,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33273
33307
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33274
33308
|
|
|
33275
33309
|
|
|
33276
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.
|
|
33310
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.12";
|
|
33277
33311
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33278
33312
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33279
33313
|
|
package/dist/orderbook.d.ts
CHANGED
|
@@ -714,30 +714,42 @@ type CancelOrdersRequestBody = {
|
|
|
714
714
|
signature: string;
|
|
715
715
|
};
|
|
716
716
|
|
|
717
|
+
type FailedOrderCancellation = {
|
|
718
|
+
/**
|
|
719
|
+
* ID of the order which failed to be cancelled
|
|
720
|
+
*/
|
|
721
|
+
order: string;
|
|
722
|
+
/**
|
|
723
|
+
* Reason code indicating why the order failed to be cancelled
|
|
724
|
+
*/
|
|
725
|
+
reason_code: FailedOrderCancellation.reason_code;
|
|
726
|
+
};
|
|
727
|
+
declare namespace FailedOrderCancellation {
|
|
728
|
+
/**
|
|
729
|
+
* Reason code indicating why the order failed to be cancelled
|
|
730
|
+
*/
|
|
731
|
+
enum reason_code {
|
|
732
|
+
ALREADY_FILLED = "ALREADY_FILLED"
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
type CancelOrdersResultData = {
|
|
737
|
+
/**
|
|
738
|
+
* Orders which were successfully cancelled
|
|
739
|
+
*/
|
|
740
|
+
successful_cancellations: Array<string>;
|
|
741
|
+
/**
|
|
742
|
+
* Orders which are marked for cancellation but the cancellation cannot be guaranteed
|
|
743
|
+
*/
|
|
744
|
+
pending_cancellations: Array<string>;
|
|
745
|
+
/**
|
|
746
|
+
* Orders which failed to be cancelled
|
|
747
|
+
*/
|
|
748
|
+
failed_cancellations: Array<FailedOrderCancellation>;
|
|
749
|
+
};
|
|
750
|
+
|
|
717
751
|
type CancelOrdersResult = {
|
|
718
|
-
result:
|
|
719
|
-
/**
|
|
720
|
-
* Orders which were successfully cancelled
|
|
721
|
-
*/
|
|
722
|
-
successful_cancellations: Array<string>;
|
|
723
|
-
/**
|
|
724
|
-
* Orders which are marked for cancellation but the cancellation cannot be guaranteed
|
|
725
|
-
*/
|
|
726
|
-
pending_cancellations: Array<string>;
|
|
727
|
-
/**
|
|
728
|
-
* Orders which failed to be cancelled
|
|
729
|
-
*/
|
|
730
|
-
failed_cancellations: Array<{
|
|
731
|
-
/**
|
|
732
|
-
* ID of the order which failed to be cancelled
|
|
733
|
-
*/
|
|
734
|
-
order: string;
|
|
735
|
-
/**
|
|
736
|
-
* Reason code indicating why the order failed to be cancelled
|
|
737
|
-
*/
|
|
738
|
-
reason_code: 'ALREADY_FILLED';
|
|
739
|
-
}>;
|
|
740
|
-
};
|
|
752
|
+
result: CancelOrdersResultData;
|
|
741
753
|
};
|
|
742
754
|
|
|
743
755
|
/**
|
|
@@ -1132,7 +1144,7 @@ declare class OrdersService {
|
|
|
1132
1144
|
* @returns ListListingsResult OK response.
|
|
1133
1145
|
* @throws ApiError
|
|
1134
1146
|
*/
|
|
1135
|
-
listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, }: {
|
|
1147
|
+
listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
|
|
1136
1148
|
chainName: ChainName;
|
|
1137
1149
|
/**
|
|
1138
1150
|
* Order status to filter by
|
|
@@ -1150,6 +1162,10 @@ declare class OrdersService {
|
|
|
1150
1162
|
* Sell item token identifier to filter by
|
|
1151
1163
|
*/
|
|
1152
1164
|
sellItemTokenId?: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* From updated at including given date
|
|
1167
|
+
*/
|
|
1168
|
+
fromUpdatedAt?: string;
|
|
1153
1169
|
/**
|
|
1154
1170
|
* Maximum number of orders to return per page
|
|
1155
1171
|
*/
|
|
@@ -1211,9 +1227,13 @@ declare class OrdersService {
|
|
|
1211
1227
|
* @returns ListTradeResult OK response.
|
|
1212
1228
|
* @throws ApiError
|
|
1213
1229
|
*/
|
|
1214
|
-
listTrades({ chainName, accountAddress, pageSize, sortBy, sortDirection, pageCursor, }: {
|
|
1230
|
+
listTrades({ chainName, accountAddress, fromIndexedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
|
|
1215
1231
|
chainName: ChainName;
|
|
1216
1232
|
accountAddress?: string;
|
|
1233
|
+
/**
|
|
1234
|
+
* From indexed at including given date
|
|
1235
|
+
*/
|
|
1236
|
+
fromIndexedAt?: string;
|
|
1217
1237
|
/**
|
|
1218
1238
|
* Maximum number of trades to return per page
|
|
1219
1239
|
*/
|