@imtbl/sdk 0.22.1 → 0.22.3
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.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +409 -171
- package/dist/checkout_sdk.js +265 -177
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +304 -192
- package/dist/index.d.ts +434 -182
- package/dist/index.js +304 -192
- package/dist/passport.js +38 -15
- package/package.json +2 -1
package/dist/checkout_sdk.js
CHANGED
|
@@ -19815,7 +19815,7 @@ class APIError extends Error {
|
|
|
19815
19815
|
|
|
19816
19816
|
/* eslint-disable implicit-arrow-linebreak */
|
|
19817
19817
|
const defaultHeaders = {
|
|
19818
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.
|
|
19818
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.3',
|
|
19819
19819
|
};
|
|
19820
19820
|
/**
|
|
19821
19821
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -20091,18 +20091,8 @@ class BlockchainData {
|
|
|
20091
20091
|
|
|
20092
20092
|
|
|
20093
20093
|
|
|
20094
|
-
var $aa144554f9ef124b$export$226b052ecb8ca80;
|
|
20095
|
-
(function(BuyStatusType) {
|
|
20096
|
-
BuyStatusType["SUCCESS"] = "SUCCESS";
|
|
20097
|
-
BuyStatusType["FAILED"] = "FAILED";
|
|
20098
|
-
})($aa144554f9ef124b$export$226b052ecb8ca80 || ($aa144554f9ef124b$export$226b052ecb8ca80 = {}));
|
|
20099
20094
|
|
|
20100
20095
|
|
|
20101
|
-
var $1e6b81bbd98b3a91$export$c0189a8c30039654;
|
|
20102
|
-
(function(CancelStatusType) {
|
|
20103
|
-
CancelStatusType["SUCCESS"] = "SUCCESS";
|
|
20104
|
-
CancelStatusType["FAILED"] = "FAILED";
|
|
20105
|
-
})($1e6b81bbd98b3a91$export$c0189a8c30039654 || ($1e6b81bbd98b3a91$export$c0189a8c30039654 = {}));
|
|
20106
20096
|
|
|
20107
20097
|
|
|
20108
20098
|
/**
|
|
@@ -20156,11 +20146,6 @@ var $a47e48dd2c04791b$export$1f05a55fe0680cc7;
|
|
|
20156
20146
|
|
|
20157
20147
|
|
|
20158
20148
|
|
|
20159
|
-
var $c2874b006e92b115$export$a9780122aaa0801a;
|
|
20160
|
-
(function(SellStatusType) {
|
|
20161
|
-
SellStatusType["SUCCESS"] = "SUCCESS";
|
|
20162
|
-
SellStatusType["FAILED"] = "FAILED";
|
|
20163
|
-
})($c2874b006e92b115$export$a9780122aaa0801a || ($c2874b006e92b115$export$a9780122aaa0801a = {}));
|
|
20164
20149
|
|
|
20165
20150
|
|
|
20166
20151
|
var $08d5ddc39acd6833$export$fd9b17d87f4121d2;
|
|
@@ -20530,6 +20515,12 @@ const $d85ad1457a3f1a83$export$8b8be7a2a654f23e = [
|
|
|
20530
20515
|
];
|
|
20531
20516
|
|
|
20532
20517
|
|
|
20518
|
+
var $4b58188d47aafe8d$export$de7bcda3c490bf18;
|
|
20519
|
+
(function(CheckoutStatus) {
|
|
20520
|
+
CheckoutStatus["SUCCESS"] = "SUCCESS";
|
|
20521
|
+
CheckoutStatus["FAILED"] = "FAILED";
|
|
20522
|
+
CheckoutStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
20523
|
+
})($4b58188d47aafe8d$export$de7bcda3c490bf18 || ($4b58188d47aafe8d$export$de7bcda3c490bf18 = {}));
|
|
20533
20524
|
var $4b58188d47aafe8d$export$1fc8f52ad1810e52;
|
|
20534
20525
|
(function(ItemType) {
|
|
20535
20526
|
ItemType["NATIVE"] = "NATIVE";
|
|
@@ -20546,12 +20537,18 @@ var $4b58188d47aafe8d$export$537fa3efd10ed435;
|
|
|
20546
20537
|
GasTokenType["NATIVE"] = "NATIVE";
|
|
20547
20538
|
GasTokenType["ERC20"] = "ERC20";
|
|
20548
20539
|
})($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
|
|
20549
|
-
var $4b58188d47aafe8d$export$
|
|
20550
|
-
(function(
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
})($4b58188d47aafe8d$export$
|
|
20540
|
+
var $4b58188d47aafe8d$export$d0616bd3e995b8be;
|
|
20541
|
+
(function(RoutingOutcomeType) {
|
|
20542
|
+
RoutingOutcomeType["ROUTES_FOUND"] = "ROUTES_FOUND";
|
|
20543
|
+
RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
|
|
20544
|
+
RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
|
|
20545
|
+
})($4b58188d47aafe8d$export$d0616bd3e995b8be || ($4b58188d47aafe8d$export$d0616bd3e995b8be = {}));
|
|
20546
|
+
var $4b58188d47aafe8d$export$6fbaa98ee06d03e8;
|
|
20547
|
+
(function(FundingStepType) {
|
|
20548
|
+
FundingStepType["BRIDGE"] = "BRIDGE";
|
|
20549
|
+
FundingStepType["SWAP"] = "SWAP";
|
|
20550
|
+
FundingStepType["ONRAMP"] = "ONRAMP";
|
|
20551
|
+
})($4b58188d47aafe8d$export$6fbaa98ee06d03e8 || ($4b58188d47aafe8d$export$6fbaa98ee06d03e8 = {}));
|
|
20555
20552
|
|
|
20556
20553
|
|
|
20557
20554
|
var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
@@ -21561,7 +21558,6 @@ async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProvide
|
|
|
21561
21558
|
|
|
21562
21559
|
|
|
21563
21560
|
|
|
21564
|
-
|
|
21565
21561
|
const $ddc6bcd0896481e5$export$2fbfa41a4de56a89 = (erc20allowances, erc721allowances)=>{
|
|
21566
21562
|
const aggregatedAllowances = [];
|
|
21567
21563
|
if (!erc20allowances.sufficient) {
|
|
@@ -22214,7 +22210,7 @@ const $1fda5c40669a566d$export$2e83e9eeaf217e20 = async ()=>false;
|
|
|
22214
22210
|
|
|
22215
22211
|
|
|
22216
22212
|
const $7f2e17f026d4fc8d$var$isPassportProvider = (provider)=>(provider.provider?.isPassport === true) ?? false;
|
|
22217
|
-
const $7f2e17f026d4fc8d$export$
|
|
22213
|
+
const $7f2e17f026d4fc8d$export$86d9f998ddda013e = async (config, provider)=>{
|
|
22218
22214
|
const availableRoutingOptions = {
|
|
22219
22215
|
onRamp: config.isOnRampEnabled,
|
|
22220
22216
|
swap: config.isSwapEnabled,
|
|
@@ -22247,13 +22243,6 @@ const $7f2e17f026d4fc8d$export$f1ca3744c025ab81 = async (config, provider)=>{
|
|
|
22247
22243
|
|
|
22248
22244
|
|
|
22249
22245
|
|
|
22250
|
-
var $b23305044c0e096a$export$3057de18ac0c076;
|
|
22251
|
-
(function(RouteCalculatorType) {
|
|
22252
|
-
RouteCalculatorType["ROUTES_FOUND"] = "ROUTES_FOUND";
|
|
22253
|
-
RouteCalculatorType["NO_ROUTES"] = "NO_ROUTES";
|
|
22254
|
-
RouteCalculatorType["NO_OPTIONS"] = "NO_OPTIONS";
|
|
22255
|
-
})($b23305044c0e096a$export$3057de18ac0c076 || ($b23305044c0e096a$export$3057de18ac0c076 = {}));
|
|
22256
|
-
|
|
22257
22246
|
|
|
22258
22247
|
|
|
22259
22248
|
|
|
@@ -22370,6 +22359,44 @@ const $3ee85f12225c19f3$export$fb80fe94a81a3132 = async (config, dexQuoteCache,
|
|
|
22370
22359
|
};
|
|
22371
22360
|
|
|
22372
22361
|
|
|
22362
|
+
const $91807edfd7057288$export$db6bd467891859dc = (chainId, fundsRequired, userBalance)=>{
|
|
22363
|
+
const tokenAddress = userBalance.token.address;
|
|
22364
|
+
let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20;
|
|
22365
|
+
if (tokenAddress === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
|
|
22366
|
+
return {
|
|
22367
|
+
type: ($4b58188d47aafe8d$export$6fbaa98ee06d03e8).SWAP,
|
|
22368
|
+
chainId: chainId,
|
|
22369
|
+
fundingItem: {
|
|
22370
|
+
type: type,
|
|
22371
|
+
fundsRequired: {
|
|
22372
|
+
amount: fundsRequired,
|
|
22373
|
+
formattedAmount: (utils).formatUnits(fundsRequired, userBalance.token.decimals)
|
|
22374
|
+
},
|
|
22375
|
+
userBalance: {
|
|
22376
|
+
balance: userBalance.balance,
|
|
22377
|
+
formattedBalance: userBalance.formattedBalance
|
|
22378
|
+
},
|
|
22379
|
+
token: userBalance.token
|
|
22380
|
+
},
|
|
22381
|
+
// WT-1734 - Add fees
|
|
22382
|
+
fees: {
|
|
22383
|
+
approvalGasFees: {
|
|
22384
|
+
amount: (BigNumber$1).from(0),
|
|
22385
|
+
formattedAmount: "0"
|
|
22386
|
+
},
|
|
22387
|
+
swapGasFees: {
|
|
22388
|
+
amount: (BigNumber$1).from(0),
|
|
22389
|
+
formattedAmount: "0"
|
|
22390
|
+
},
|
|
22391
|
+
swapFees: [
|
|
22392
|
+
{
|
|
22393
|
+
amount: (BigNumber$1).from(0),
|
|
22394
|
+
formattedAmount: "0"
|
|
22395
|
+
}
|
|
22396
|
+
]
|
|
22397
|
+
}
|
|
22398
|
+
};
|
|
22399
|
+
};
|
|
22373
22400
|
const $91807edfd7057288$export$85e4d8628aabb217 = (balanceRequirement)=>{
|
|
22374
22401
|
let address = "";
|
|
22375
22402
|
let amount = (BigNumber$1).from(0);
|
|
@@ -22458,7 +22485,8 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
22458
22485
|
if (swappableTokens.length === 0) return fundingSteps;
|
|
22459
22486
|
const requiredToken = $91807edfd7057288$export$85e4d8628aabb217(balanceRequirement);
|
|
22460
22487
|
if (requiredToken.address === "") return fundingSteps;
|
|
22461
|
-
const
|
|
22488
|
+
const chainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
|
|
22489
|
+
const l2TokenBalanceResult = tokenBalanceResults.get(chainId);
|
|
22462
22490
|
if (!l2TokenBalanceResult) return fundingSteps;
|
|
22463
22491
|
const l2Balances = l2TokenBalanceResult.balances;
|
|
22464
22492
|
if (l2Balances.length === 0) return fundingSteps;
|
|
@@ -22485,15 +22513,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
|
|
|
22485
22513
|
})) continue;
|
|
22486
22514
|
// User has sufficient funds to cover any approval and swap fees so use this token for the funding route
|
|
22487
22515
|
// Currently we are not prioritising any particular token so just taking the first sufficient token
|
|
22488
|
-
fundingSteps.push(
|
|
22489
|
-
type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).SWAP,
|
|
22490
|
-
chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
|
|
22491
|
-
asset: {
|
|
22492
|
-
balance: userBalanceOfQuotedToken.balance,
|
|
22493
|
-
formattedBalance: userBalanceOfQuotedToken.formattedBalance,
|
|
22494
|
-
token: userBalanceOfQuotedToken.token
|
|
22495
|
-
}
|
|
22496
|
-
});
|
|
22516
|
+
fundingSteps.push($91807edfd7057288$export$db6bd467891859dc(chainId, amountOfQuoteTokenRequired.value, userBalanceOfQuotedToken));
|
|
22497
22517
|
}
|
|
22498
22518
|
return fundingSteps;
|
|
22499
22519
|
};
|
|
@@ -22551,6 +22571,7 @@ const $5a5ccedc98d53d25$export$1ad29657d49c5440 = async (config, tokenBalances,
|
|
|
22551
22571
|
|
|
22552
22572
|
|
|
22553
22573
|
|
|
22574
|
+
|
|
22554
22575
|
const $f730af3b727f04ac$export$22fea095b15361de = (balances)=>{
|
|
22555
22576
|
for (const balance of balances.balances){
|
|
22556
22577
|
if (!balance.token.address || balance.token.address === "") return balance.balance;
|
|
@@ -22563,7 +22584,7 @@ const $f730af3b727f04ac$export$22fea095b15361de = (balances)=>{
|
|
|
22563
22584
|
|
|
22564
22585
|
|
|
22565
22586
|
|
|
22566
|
-
const $
|
|
22587
|
+
const $15fe1c77041bd4f4$export$9e73e22953cebcfc = async (config, readOnlyProviders)=>{
|
|
22567
22588
|
try {
|
|
22568
22589
|
const estimate = await (0, $2e7bf45a7c9a9570$export$942c8de7174809fc)({
|
|
22569
22590
|
gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
|
|
@@ -22574,7 +22595,18 @@ const $8a49d1a3783a2640$export$3aff971444a4f244 = async (config, readOnlyProvide
|
|
|
22574
22595
|
let totalFees = (0, BigNumber$1).from(0);
|
|
22575
22596
|
if (gasEstimate) totalFees = totalFees.add(gasEstimate);
|
|
22576
22597
|
if (bridgeFee) totalFees = totalFees.add(bridgeFee);
|
|
22577
|
-
return
|
|
22598
|
+
return {
|
|
22599
|
+
type: (0, $4b58188d47aafe8d$export$6fbaa98ee06d03e8).BRIDGE,
|
|
22600
|
+
gasFee: {
|
|
22601
|
+
estimatedAmount: gasEstimate ?? (0, BigNumber$1).from(0),
|
|
22602
|
+
token: estimate.gasFee.token
|
|
22603
|
+
},
|
|
22604
|
+
bridgeFee: {
|
|
22605
|
+
estimatedAmount: bridgeFee ?? (0, BigNumber$1).from(0),
|
|
22606
|
+
token: estimate.bridgeFee.token
|
|
22607
|
+
},
|
|
22608
|
+
totalFees: totalFees
|
|
22609
|
+
};
|
|
22578
22610
|
} catch (err) {
|
|
22579
22611
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error estimating gas for bridge", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).BRIDGE_GAS_ESTIMATE_ERROR, {
|
|
22580
22612
|
message: err.message
|
|
@@ -22662,24 +22694,48 @@ const $fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665 = (tokenBalanceResult, totalFees
|
|
|
22662
22694
|
return balance.gte(totalFees);
|
|
22663
22695
|
};
|
|
22664
22696
|
const $fa9ac5bfdbbf9dfa$export$da05aed50d75046 = async (config, readOnlyProviders, feeEstimates)=>{
|
|
22665
|
-
let bridgeFeeEstimate = feeEstimates.get(($4b58188d47aafe8d$export$
|
|
22697
|
+
let bridgeFeeEstimate = feeEstimates.get(($4b58188d47aafe8d$export$6fbaa98ee06d03e8).BRIDGE);
|
|
22666
22698
|
if (bridgeFeeEstimate) return bridgeFeeEstimate;
|
|
22667
|
-
bridgeFeeEstimate = await ($
|
|
22668
|
-
feeEstimates.set(($4b58188d47aafe8d$export$
|
|
22699
|
+
bridgeFeeEstimate = await ($15fe1c77041bd4f4$export$9e73e22953cebcfc)(config, readOnlyProviders);
|
|
22700
|
+
feeEstimates.set(($4b58188d47aafe8d$export$6fbaa98ee06d03e8).BRIDGE, bridgeFeeEstimate);
|
|
22669
22701
|
return bridgeFeeEstimate;
|
|
22670
22702
|
};
|
|
22671
|
-
const $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute = (chainId, balance)=>({
|
|
22672
|
-
type: ($4b58188d47aafe8d$export$
|
|
22703
|
+
const $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute = (chainId, balance, bridgeRequirement, itemType)=>({
|
|
22704
|
+
type: ($4b58188d47aafe8d$export$6fbaa98ee06d03e8).BRIDGE,
|
|
22673
22705
|
chainId: chainId,
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22706
|
+
fundingItem: {
|
|
22707
|
+
type: itemType,
|
|
22708
|
+
fundsRequired: {
|
|
22709
|
+
amount: bridgeRequirement.amount,
|
|
22710
|
+
formattedAmount: bridgeRequirement.formattedAmount
|
|
22711
|
+
},
|
|
22712
|
+
userBalance: {
|
|
22713
|
+
balance: balance.balance,
|
|
22714
|
+
formattedBalance: balance.formattedBalance
|
|
22715
|
+
},
|
|
22677
22716
|
token: {
|
|
22678
22717
|
name: balance.token.name,
|
|
22679
22718
|
symbol: balance.token.symbol,
|
|
22680
22719
|
address: balance.token.address,
|
|
22681
22720
|
decimals: balance.token.decimals
|
|
22682
22721
|
}
|
|
22722
|
+
},
|
|
22723
|
+
// WT-1734 - Add fees
|
|
22724
|
+
fees: {
|
|
22725
|
+
approvalGasFees: {
|
|
22726
|
+
amount: (BigNumber$1).from(0),
|
|
22727
|
+
formattedAmount: "0"
|
|
22728
|
+
},
|
|
22729
|
+
bridgeGasFees: {
|
|
22730
|
+
amount: (BigNumber$1).from(0),
|
|
22731
|
+
formattedAmount: "0"
|
|
22732
|
+
},
|
|
22733
|
+
bridgeFees: [
|
|
22734
|
+
{
|
|
22735
|
+
amount: (BigNumber$1).from(0),
|
|
22736
|
+
formattedAmount: "0"
|
|
22737
|
+
}
|
|
22738
|
+
]
|
|
22683
22739
|
}
|
|
22684
22740
|
});
|
|
22685
22741
|
const $fa9ac5bfdbbf9dfa$export$3139474685e4dedd = (address)=>{
|
|
@@ -22701,7 +22757,7 @@ const $fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa = async (config, readOnlyProvide
|
|
|
22701
22757
|
if (allowedTokenList.length === 0) return undefined;
|
|
22702
22758
|
const bridgeFeeEstimate = await $fa9ac5bfdbbf9dfa$export$da05aed50d75046(config, readOnlyProviders, feeEstimates);
|
|
22703
22759
|
// If the user has no ETH to cover the bridge fees or approval fees then bridge cannot be an option
|
|
22704
|
-
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, bridgeFeeEstimate)) return undefined;
|
|
22760
|
+
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, bridgeFeeEstimate.totalFees)) return undefined;
|
|
22705
22761
|
const l1RepresentationResult = await ($887d24b47765b1c0$export$952cdf461a00a8c6)(config, bridgeRequirement.l2address);
|
|
22706
22762
|
// No mapping on L1 for this token
|
|
22707
22763
|
const { l1address: l1address } = l1RepresentationResult;
|
|
@@ -22711,16 +22767,20 @@ const $fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa = async (config, readOnlyProvide
|
|
|
22711
22767
|
if (!allowedTokenList.find((token)=>!("address" in token))) return undefined;
|
|
22712
22768
|
} else if (!allowedTokenList.find((token)=>token.address === l1address)) return undefined;
|
|
22713
22769
|
const gasForApproval = await ($07ac9c0576988336$export$a3dd181de896b7c7)(config, readOnlyProviders, l1provider, depositorAddress, l1address, bridgeRequirement.amount);
|
|
22714
|
-
|
|
22770
|
+
let totalFees = bridgeFeeEstimate.bridgeFee.estimatedAmount;
|
|
22715
22771
|
// If the L1 representation of the requirement is ETH then find the ETH balance and check if the balance covers the delta
|
|
22716
22772
|
if (l1address === ($887d24b47765b1c0$export$c37d8687c27b9660)) {
|
|
22717
22773
|
const nativeETHBalance = tokenBalanceResult.balances.find((balance)=>$fa9ac5bfdbbf9dfa$export$3139474685e4dedd(balance.token.address));
|
|
22718
|
-
if (
|
|
22774
|
+
if (bridgeFeeEstimate.gasFee.estimatedAmount) totalFees = totalFees.add(bridgeFeeEstimate.gasFee.estimatedAmount);
|
|
22775
|
+
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, totalFees)) return undefined;
|
|
22776
|
+
if (nativeETHBalance && nativeETHBalance.balance.gte(bridgeRequirement.amount.add(totalFees))) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, nativeETHBalance, bridgeRequirement, ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE);
|
|
22719
22777
|
return undefined;
|
|
22720
22778
|
}
|
|
22779
|
+
totalFees.add(gasForApproval).add(bridgeFeeEstimate.gasFee.estimatedAmount);
|
|
22780
|
+
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, totalFees)) return undefined;
|
|
22721
22781
|
// Find the balance of the L1 representation of the token and check if the balance covers the delta
|
|
22722
22782
|
const erc20balance = tokenBalanceResult.balances.find((balance)=>balance.token.address === l1address);
|
|
22723
|
-
if (erc20balance && erc20balance.balance.gte(bridgeRequirement.amount)) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, erc20balance);
|
|
22783
|
+
if (erc20balance && erc20balance.balance.gte(bridgeRequirement.amount)) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, erc20balance, bridgeRequirement, ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20);
|
|
22724
22784
|
return undefined;
|
|
22725
22785
|
};
|
|
22726
22786
|
|
|
@@ -22906,18 +22966,19 @@ const $afd57acae9471ac5$var$modifyTokenBalancesWithBridgedAmount = (config, toke
|
|
|
22906
22966
|
const $afd57acae9471ac5$export$1fc63300bde5e690 = (tokenBalances, swapRoutes)=>{
|
|
22907
22967
|
const originalSwapSteps = [];
|
|
22908
22968
|
for (const route of swapRoutes){
|
|
22909
|
-
const { chainId: chainId,
|
|
22969
|
+
const { chainId: chainId, fundingItem: fundingItem } = route;
|
|
22970
|
+
const { userBalance: userBalance } = route.fundingItem;
|
|
22910
22971
|
const tokenBalance = tokenBalances.get(chainId);
|
|
22911
22972
|
if (!tokenBalance) continue;
|
|
22912
22973
|
let originalBalance = (BigNumber$1).from(0);
|
|
22913
22974
|
let originalFormattedBalance = "0";
|
|
22914
|
-
const l2balance = tokenBalance.balances.find((balance)=>balance.token.address ===
|
|
22975
|
+
const l2balance = tokenBalance.balances.find((balance)=>balance.token.address === fundingItem.token.address);
|
|
22915
22976
|
if (l2balance) {
|
|
22916
22977
|
originalBalance = l2balance.balance;
|
|
22917
22978
|
originalFormattedBalance = l2balance.formattedBalance;
|
|
22918
22979
|
}
|
|
22919
|
-
|
|
22920
|
-
|
|
22980
|
+
userBalance.balance = originalBalance;
|
|
22981
|
+
userBalance.formattedBalance = originalFormattedBalance;
|
|
22921
22982
|
originalSwapSteps.push(route);
|
|
22922
22983
|
}
|
|
22923
22984
|
return originalSwapSteps;
|
|
@@ -22927,11 +22988,11 @@ const $afd57acae9471ac5$export$d9b96654eebdaf2a = (bridgeFundingSteps, swapFundi
|
|
|
22927
22988
|
for (const bridgeFundingStep of bridgeFundingSteps){
|
|
22928
22989
|
if (!bridgeFundingStep) continue;
|
|
22929
22990
|
const mapping = l1tol2Addresses.find((addresses)=>{
|
|
22930
|
-
if (bridgeFundingStep.
|
|
22931
|
-
return addresses.l1address === bridgeFundingStep.
|
|
22991
|
+
if (bridgeFundingStep.fundingItem.token.address === undefined) return addresses.l1address === ($887d24b47765b1c0$export$c37d8687c27b9660) && addresses.l2address;
|
|
22992
|
+
return addresses.l1address === bridgeFundingStep.fundingItem.token.address && addresses.l2address;
|
|
22932
22993
|
});
|
|
22933
22994
|
if (!mapping) continue;
|
|
22934
|
-
const swapFundingStep = swapFundingSteps.find((step)=>step.
|
|
22995
|
+
const swapFundingStep = swapFundingSteps.find((step)=>step.fundingItem.token.address === mapping.l2address);
|
|
22935
22996
|
if (!swapFundingStep) continue;
|
|
22936
22997
|
bridgeAndSwapRoutes.push({
|
|
22937
22998
|
bridgeFundingStep: bridgeFundingStep,
|
|
@@ -23007,22 +23068,27 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
|
|
|
23007
23068
|
|
|
23008
23069
|
const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutingOptions, balanceRequirement)=>{
|
|
23009
23070
|
if (balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return undefined;
|
|
23010
|
-
const
|
|
23071
|
+
const { required: required, current: current, delta: delta } = balanceRequirement;
|
|
23011
23072
|
let hasAllowList = false;
|
|
23012
23073
|
const onRampProvidersAllowList = await ($5a5ccedc98d53d25$export$9ec9fc71f3ce62c4)(config, availableRoutingOptions);
|
|
23013
23074
|
Object.values(onRampProvidersAllowList).forEach((onRampAllowList)=>{
|
|
23014
|
-
if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address ===
|
|
23075
|
+
if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address === required.token?.address);
|
|
23015
23076
|
});
|
|
23016
23077
|
if (!hasAllowList) return undefined;
|
|
23017
23078
|
return {
|
|
23018
|
-
type: ($4b58188d47aafe8d$export$
|
|
23079
|
+
type: ($4b58188d47aafe8d$export$6fbaa98ee06d03e8).ONRAMP,
|
|
23019
23080
|
chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
}
|
|
23081
|
+
fundingItem: {
|
|
23082
|
+
type: required.token.address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9) ? ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE : ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20,
|
|
23083
|
+
fundsRequired: {
|
|
23084
|
+
amount: delta.balance,
|
|
23085
|
+
formattedAmount: delta.formattedBalance
|
|
23086
|
+
},
|
|
23087
|
+
userBalance: {
|
|
23088
|
+
balance: current.balance,
|
|
23089
|
+
formattedBalance: current.formattedBalance
|
|
23090
|
+
},
|
|
23091
|
+
token: required.token
|
|
23026
23092
|
}
|
|
23027
23093
|
};
|
|
23028
23094
|
};
|
|
@@ -23096,11 +23162,8 @@ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutin
|
|
|
23096
23162
|
};
|
|
23097
23163
|
const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
|
|
23098
23164
|
if (!$c16168a9c28ae4fd$var$hasAvailableRoutingOptions(availableRoutingOptions)) return {
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
message: "No options available"
|
|
23102
|
-
},
|
|
23103
|
-
fundingRoutes: []
|
|
23165
|
+
type: ($4b58188d47aafe8d$export$d0616bd3e995b8be).NO_ROUTE_OPTIONS,
|
|
23166
|
+
message: "No routing options are available"
|
|
23104
23167
|
};
|
|
23105
23168
|
let readOnlyProviders;
|
|
23106
23169
|
try {
|
|
@@ -23134,25 +23197,37 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
23134
23197
|
if (index === 2) onRampFundingStep = result;
|
|
23135
23198
|
if (index === 3) bridgeAndSwapFundingSteps = result;
|
|
23136
23199
|
});
|
|
23200
|
+
if (!bridgeFundingStep && swapFundingSteps.length === 0 && !onRampFundingStep && bridgeAndSwapFundingSteps.length === 0) return {
|
|
23201
|
+
type: ($4b58188d47aafe8d$export$d0616bd3e995b8be).NO_ROUTES_FOUND,
|
|
23202
|
+
message: "Smart Checkout did not find any funding routes to fulfill the transaction"
|
|
23203
|
+
};
|
|
23137
23204
|
const response = {
|
|
23138
|
-
|
|
23139
|
-
type: ($b23305044c0e096a$export$3057de18ac0c076).NO_ROUTES,
|
|
23140
|
-
message: "Routes not found"
|
|
23141
|
-
},
|
|
23205
|
+
type: ($4b58188d47aafe8d$export$d0616bd3e995b8be).ROUTES_FOUND,
|
|
23142
23206
|
fundingRoutes: []
|
|
23143
23207
|
};
|
|
23144
23208
|
let priority = 0;
|
|
23145
|
-
if (bridgeFundingStep || swapFundingSteps.length > 0 || onRampFundingStep || bridgeAndSwapFundingSteps.length > 0) {
|
|
23146
|
-
response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
|
|
23147
|
-
response.response.message = "Routes found";
|
|
23148
|
-
}
|
|
23149
23209
|
if (bridgeFundingStep) {
|
|
23150
23210
|
priority++;
|
|
23151
23211
|
response.fundingRoutes.push({
|
|
23152
23212
|
priority: priority,
|
|
23153
23213
|
steps: [
|
|
23154
23214
|
bridgeFundingStep
|
|
23155
|
-
]
|
|
23215
|
+
],
|
|
23216
|
+
// WT-1734 - Add fees
|
|
23217
|
+
totalFees: {
|
|
23218
|
+
gas: {
|
|
23219
|
+
amount: (BigNumber$1).from(0),
|
|
23220
|
+
formattedAmount: "0"
|
|
23221
|
+
},
|
|
23222
|
+
other: {
|
|
23223
|
+
amount: (BigNumber$1).from(0),
|
|
23224
|
+
formattedAmount: "0"
|
|
23225
|
+
},
|
|
23226
|
+
total: {
|
|
23227
|
+
amount: (BigNumber$1).from(0),
|
|
23228
|
+
formattedAmount: "0"
|
|
23229
|
+
}
|
|
23230
|
+
}
|
|
23156
23231
|
});
|
|
23157
23232
|
}
|
|
23158
23233
|
if (swapFundingSteps.length > 0) {
|
|
@@ -23162,7 +23237,22 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
23162
23237
|
priority: priority,
|
|
23163
23238
|
steps: [
|
|
23164
23239
|
swapFundingStep
|
|
23165
|
-
]
|
|
23240
|
+
],
|
|
23241
|
+
// WT-1734 - Add fees
|
|
23242
|
+
totalFees: {
|
|
23243
|
+
gas: {
|
|
23244
|
+
amount: (BigNumber$1).from(0),
|
|
23245
|
+
formattedAmount: "0"
|
|
23246
|
+
},
|
|
23247
|
+
other: {
|
|
23248
|
+
amount: (BigNumber$1).from(0),
|
|
23249
|
+
formattedAmount: "0"
|
|
23250
|
+
},
|
|
23251
|
+
total: {
|
|
23252
|
+
amount: (BigNumber$1).from(0),
|
|
23253
|
+
formattedAmount: "0"
|
|
23254
|
+
}
|
|
23255
|
+
}
|
|
23166
23256
|
});
|
|
23167
23257
|
});
|
|
23168
23258
|
}
|
|
@@ -23185,34 +23275,29 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
23185
23275
|
steps: [
|
|
23186
23276
|
bridgeStep,
|
|
23187
23277
|
swapStep
|
|
23188
|
-
]
|
|
23278
|
+
],
|
|
23279
|
+
// WT-1734 - Add fees
|
|
23280
|
+
totalFees: {
|
|
23281
|
+
gas: {
|
|
23282
|
+
amount: (BigNumber$1).from(0),
|
|
23283
|
+
formattedAmount: "0"
|
|
23284
|
+
},
|
|
23285
|
+
other: {
|
|
23286
|
+
amount: (BigNumber$1).from(0),
|
|
23287
|
+
formattedAmount: "0"
|
|
23288
|
+
},
|
|
23289
|
+
total: {
|
|
23290
|
+
amount: (BigNumber$1).from(0),
|
|
23291
|
+
formattedAmount: "0"
|
|
23292
|
+
}
|
|
23293
|
+
}
|
|
23189
23294
|
});
|
|
23190
23295
|
});
|
|
23191
23296
|
}
|
|
23192
|
-
// eslint-disable-next-line no-console
|
|
23193
|
-
console.log("** response", response);
|
|
23194
23297
|
return response;
|
|
23195
23298
|
};
|
|
23196
23299
|
|
|
23197
23300
|
|
|
23198
|
-
const $0e7419077c373b24$export$4a2a19d99fef3b1b = (balanceCheckResult)=>{
|
|
23199
|
-
let sufficient = true;
|
|
23200
|
-
const transactionRequirements = [];
|
|
23201
|
-
for (const balance of balanceCheckResult.balanceRequirements){
|
|
23202
|
-
if (!balance.sufficient) sufficient = false;
|
|
23203
|
-
transactionRequirements.push({
|
|
23204
|
-
type: balance.type,
|
|
23205
|
-
sufficient: balance.sufficient,
|
|
23206
|
-
required: balance.required,
|
|
23207
|
-
current: balance.current,
|
|
23208
|
-
delta: balance.delta
|
|
23209
|
-
});
|
|
23210
|
-
}
|
|
23211
|
-
return {
|
|
23212
|
-
sufficient: sufficient,
|
|
23213
|
-
transactionRequirements: transactionRequirements
|
|
23214
|
-
};
|
|
23215
|
-
};
|
|
23216
23301
|
const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (config, provider, itemRequirements, transactionOrGasAmount)=>{
|
|
23217
23302
|
const ownerAddress = await provider.getSigner().getAddress();
|
|
23218
23303
|
let aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(itemRequirements);
|
|
@@ -23224,12 +23309,25 @@ const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (config, provider, itemR
|
|
|
23224
23309
|
aggregatedItems.push(gasItem);
|
|
23225
23310
|
aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(aggregatedItems);
|
|
23226
23311
|
}
|
|
23227
|
-
const
|
|
23228
|
-
|
|
23229
|
-
const
|
|
23230
|
-
|
|
23231
|
-
|
|
23232
|
-
|
|
23312
|
+
const balanceCheckResult = await ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems);
|
|
23313
|
+
const { sufficient: sufficient } = balanceCheckResult;
|
|
23314
|
+
const transactionRequirements = balanceCheckResult.balanceRequirements;
|
|
23315
|
+
if (sufficient) return {
|
|
23316
|
+
sufficient: sufficient,
|
|
23317
|
+
transactionRequirements: transactionRequirements
|
|
23318
|
+
};
|
|
23319
|
+
const availableRoutingOptions = await ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider);
|
|
23320
|
+
const routingOutcome = await ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions);
|
|
23321
|
+
const isPassport = provider.provider?.isPassport || false;
|
|
23322
|
+
return {
|
|
23323
|
+
sufficient: sufficient,
|
|
23324
|
+
transactionRequirements: transactionRequirements,
|
|
23325
|
+
router: {
|
|
23326
|
+
isPassport: isPassport,
|
|
23327
|
+
availableRoutingOptions: availableRoutingOptions,
|
|
23328
|
+
routingOutcome: routingOutcome
|
|
23329
|
+
}
|
|
23330
|
+
};
|
|
23233
23331
|
};
|
|
23234
23332
|
|
|
23235
23333
|
|
|
@@ -23474,7 +23572,6 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
23474
23572
|
unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
|
|
23475
23573
|
} catch {
|
|
23476
23574
|
// Silently ignore error as this is usually thrown if user does not have enough balance
|
|
23477
|
-
// todo: if balance error - can we determine if its the balance error otherwise throw?
|
|
23478
23575
|
}
|
|
23479
23576
|
try {
|
|
23480
23577
|
unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
|
|
@@ -23513,13 +23610,12 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
23513
23610
|
if (smartCheckoutResult.sufficient) {
|
|
23514
23611
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
|
|
23515
23612
|
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
23516
|
-
|
|
23517
|
-
|
|
23518
|
-
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
|
|
23522
|
-
}
|
|
23613
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
|
|
23614
|
+
transactionHash: approvalResult.transactionHash,
|
|
23615
|
+
reason: approvalResult.reason,
|
|
23616
|
+
smartCheckoutResult: [
|
|
23617
|
+
smartCheckoutResult
|
|
23618
|
+
]
|
|
23523
23619
|
};
|
|
23524
23620
|
try {
|
|
23525
23621
|
if (unsignedFulfillmentTransactions.length === 0) unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
|
|
@@ -23530,25 +23626,25 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
23530
23626
|
}
|
|
23531
23627
|
const fulfillmentResult = await ($25ac589234c10b67$export$3f05b33bd1f29038)(provider, unsignedFulfillmentTransactions);
|
|
23532
23628
|
if (fulfillmentResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
23533
|
-
|
|
23534
|
-
|
|
23535
|
-
|
|
23536
|
-
|
|
23537
|
-
|
|
23538
|
-
|
|
23539
|
-
}
|
|
23629
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
|
|
23630
|
+
transactionHash: fulfillmentResult.transactionHash,
|
|
23631
|
+
reason: fulfillmentResult.reason,
|
|
23632
|
+
smartCheckoutResult: [
|
|
23633
|
+
smartCheckoutResult
|
|
23634
|
+
]
|
|
23540
23635
|
};
|
|
23541
23636
|
return {
|
|
23542
|
-
|
|
23543
|
-
|
|
23544
|
-
|
|
23545
|
-
|
|
23546
|
-
}
|
|
23637
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).SUCCESS,
|
|
23638
|
+
smartCheckoutResult: [
|
|
23639
|
+
smartCheckoutResult
|
|
23640
|
+
]
|
|
23547
23641
|
};
|
|
23548
23642
|
}
|
|
23549
23643
|
return {
|
|
23550
|
-
|
|
23551
|
-
|
|
23644
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).INSUFFICIENT_FUNDS,
|
|
23645
|
+
smartCheckoutResult: [
|
|
23646
|
+
smartCheckoutResult
|
|
23647
|
+
]
|
|
23552
23648
|
};
|
|
23553
23649
|
};
|
|
23554
23650
|
|
|
@@ -23563,7 +23659,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
|
|
|
23563
23659
|
const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
|
|
23564
23660
|
let unsignedCancelOrderTransaction;
|
|
23565
23661
|
if (orderIds.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orderIds were passed in, must pass at least one orderId to cancel", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR);
|
|
23566
|
-
// Update this when bulk cancel is
|
|
23662
|
+
// Update this when bulk cancel is supported
|
|
23567
23663
|
const orderId = orderIds[0];
|
|
23568
23664
|
try {
|
|
23569
23665
|
const offererAddress = await provider.getSigner().getAddress();
|
|
@@ -23580,18 +23676,12 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
23580
23676
|
unsignedCancelOrderTransaction
|
|
23581
23677
|
]);
|
|
23582
23678
|
if (result.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
23583
|
-
|
|
23584
|
-
|
|
23585
|
-
|
|
23586
|
-
transactionHash: result.transactionHash,
|
|
23587
|
-
reason: result.reason
|
|
23588
|
-
}
|
|
23679
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
|
|
23680
|
+
transactionHash: result.transactionHash,
|
|
23681
|
+
reason: result.reason
|
|
23589
23682
|
};
|
|
23590
23683
|
return {
|
|
23591
|
-
|
|
23592
|
-
status: {
|
|
23593
|
-
type: ($1e6b81bbd98b3a91$export$c0189a8c30039654).SUCCESS
|
|
23594
|
-
}
|
|
23684
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).SUCCESS
|
|
23595
23685
|
};
|
|
23596
23686
|
};
|
|
23597
23687
|
|
|
@@ -23607,7 +23697,6 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
23607
23697
|
|
|
23608
23698
|
|
|
23609
23699
|
|
|
23610
|
-
|
|
23611
23700
|
const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
|
|
23612
23701
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
|
|
23613
23702
|
id: id,
|
|
@@ -23671,6 +23760,16 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
23671
23760
|
}
|
|
23672
23761
|
});
|
|
23673
23762
|
if (smartCheckoutResult.sufficient) {
|
|
23763
|
+
const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
|
|
23764
|
+
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
|
|
23765
|
+
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
23766
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).FAILED,
|
|
23767
|
+
transactionHash: approvalResult.transactionHash,
|
|
23768
|
+
reason: approvalResult.reason,
|
|
23769
|
+
smartCheckoutResult: [
|
|
23770
|
+
smartCheckoutResult
|
|
23771
|
+
]
|
|
23772
|
+
};
|
|
23674
23773
|
const unsignedMessage = ($a7367d01c6e76b1c$export$d62081fac18000c2)(listing.orderHash, listing.orderComponents, listing.actions);
|
|
23675
23774
|
if (!unsignedMessage) // For sell it is expected the orderbook will always return an unsigned message
|
|
23676
23775
|
// If for some reason it is missing then we cannot proceed with the create listing
|
|
@@ -23679,18 +23778,6 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
23679
23778
|
collectionAddress: sellToken.collectionAddress
|
|
23680
23779
|
});
|
|
23681
23780
|
const signedMessage = await ($25ac589234c10b67$export$1d9a7a8a40780de)(provider, unsignedMessage);
|
|
23682
|
-
const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
|
|
23683
|
-
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
|
|
23684
|
-
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
23685
|
-
id: sellToken.id,
|
|
23686
|
-
collectionAddress: sellToken.collectionAddress,
|
|
23687
|
-
smartCheckoutResult: smartCheckoutResult,
|
|
23688
|
-
status: {
|
|
23689
|
-
type: ($c2874b006e92b115$export$a9780122aaa0801a).FAILED,
|
|
23690
|
-
transactionHash: approvalResult.transactionHash,
|
|
23691
|
-
reason: approvalResult.reason
|
|
23692
|
-
}
|
|
23693
|
-
};
|
|
23694
23781
|
let orderId = "";
|
|
23695
23782
|
const createListingParams = {
|
|
23696
23783
|
orderComponents: signedMessage.orderComponents,
|
|
@@ -23714,19 +23801,20 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
|
|
|
23714
23801
|
});
|
|
23715
23802
|
}
|
|
23716
23803
|
return {
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23804
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).SUCCESS,
|
|
23805
|
+
orderIds: [
|
|
23806
|
+
orderId
|
|
23807
|
+
],
|
|
23808
|
+
smartCheckoutResult: [
|
|
23809
|
+
smartCheckoutResult
|
|
23810
|
+
]
|
|
23724
23811
|
};
|
|
23725
23812
|
}
|
|
23726
23813
|
return {
|
|
23727
|
-
|
|
23728
|
-
|
|
23729
|
-
|
|
23814
|
+
status: ($4b58188d47aafe8d$export$de7bcda3c490bf18).INSUFFICIENT_FUNDS,
|
|
23815
|
+
smartCheckoutResult: [
|
|
23816
|
+
smartCheckoutResult
|
|
23817
|
+
]
|
|
23730
23818
|
};
|
|
23731
23819
|
};
|
|
23732
23820
|
|
|
@@ -23938,9 +24026,9 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23938
24026
|
// eslint-disable-next-line no-console
|
|
23939
24027
|
console.warn("This endpoint is currently under construction.");
|
|
23940
24028
|
if (params.orders.length > 1) // eslint-disable-next-line no-console
|
|
23941
|
-
console.warn("This endpoint currently only
|
|
24029
|
+
console.warn("This endpoint currently only processes the first order in the array.");
|
|
23942
24030
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
23943
|
-
await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orders);
|
|
24031
|
+
return await $64863c39386de592$export$7f8e2b98eca5a7f0(this.config, web3Provider, params.orders);
|
|
23944
24032
|
}
|
|
23945
24033
|
/**
|
|
23946
24034
|
* Determines the requirements for performing a sell.
|
|
@@ -23952,9 +24040,9 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23952
24040
|
// eslint-disable-next-line no-console
|
|
23953
24041
|
console.warn("This endpoint is currently under construction.");
|
|
23954
24042
|
if (params.orders.length > 1) // eslint-disable-next-line no-console
|
|
23955
|
-
console.warn("This endpoint currently only
|
|
24043
|
+
console.warn("This endpoint currently only processes the first order in the array.");
|
|
23956
24044
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
23957
|
-
await $9085b221b72ac69e$export$e761f9e0703de895(this.config, web3Provider, params.orders);
|
|
24045
|
+
return await $9085b221b72ac69e$export$e761f9e0703de895(this.config, web3Provider, params.orders);
|
|
23958
24046
|
}
|
|
23959
24047
|
/**
|
|
23960
24048
|
* Cancels a sell.
|
|
@@ -23964,9 +24052,9 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23964
24052
|
// eslint-disable-next-line no-console
|
|
23965
24053
|
console.warn("This endpoint is currently under construction.");
|
|
23966
24054
|
// eslint-disable-next-line no-console
|
|
23967
|
-
console.warn("This endpoint currently only
|
|
24055
|
+
console.warn("This endpoint currently only processes the first order in the array.");
|
|
23968
24056
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
23969
|
-
await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderIds);
|
|
24057
|
+
return await $9c3db1bb9c8b69d3$export$70b61ad426ddbe54(this.config, web3Provider, params.orderIds);
|
|
23970
24058
|
}
|
|
23971
24059
|
/**
|
|
23972
24060
|
* Determines the transaction requirements to complete a purchase.
|
|
@@ -23982,7 +24070,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
23982
24070
|
} catch {
|
|
23983
24071
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Failed to map item requirements", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ITEM_REQUIREMENTS_ERROR);
|
|
23984
24072
|
}
|
|
23985
|
-
await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
|
|
24073
|
+
return await $0e7419077c373b24$export$9e073f9ada8c81e6(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
|
|
23986
24074
|
}
|
|
23987
24075
|
/**
|
|
23988
24076
|
* Checks if the given object is a Web3 provider.
|
|
@@ -24038,4 +24126,4 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
24038
24126
|
}
|
|
24039
24127
|
}
|
|
24040
24128
|
|
|
24041
|
-
export { $d85ad1457a3f1a83$export$161d4a74df65fc08 as CHECKOUT_API_BASE_URL, $0472f23319457bfb$export$c06e1e7429de6283 as ChainId, $0472f23319457bfb$export$b874c6b1dfe85e02 as ChainName, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $e055e79256bbc1dd$export$80f4da0d409a629d as ExchangeType, $de275b98d2b651c3$export$788b1fd17f3dad84 as GasEstimateType, $4b58188d47aafe8d$export$537fa3efd10ed435 as GasTokenType, $4b58188d47aafe8d$export$1fc8f52ad1810e52 as ItemType, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $4b58188d47aafe8d$export$65c64e46348ee3c1 as TransactionOrGasType, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes, $e768639828688ca3$export$2d7a51a18d87e21d as WalletProviderName };
|
|
24129
|
+
export { $d85ad1457a3f1a83$export$161d4a74df65fc08 as CHECKOUT_API_BASE_URL, $0472f23319457bfb$export$c06e1e7429de6283 as ChainId, $0472f23319457bfb$export$b874c6b1dfe85e02 as ChainName, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $4b58188d47aafe8d$export$de7bcda3c490bf18 as CheckoutStatus, $e055e79256bbc1dd$export$80f4da0d409a629d as ExchangeType, $de275b98d2b651c3$export$788b1fd17f3dad84 as GasEstimateType, $4b58188d47aafe8d$export$537fa3efd10ed435 as GasTokenType, $4b58188d47aafe8d$export$1fc8f52ad1810e52 as ItemType, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $4b58188d47aafe8d$export$65c64e46348ee3c1 as TransactionOrGasType, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes, $e768639828688ca3$export$2d7a51a18d87e21d as WalletProviderName };
|