@imtbl/sdk 0.18.0 → 0.18.1
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 +29 -10
- package/dist/checkout_sdk.js +350 -59
- package/dist/checkout_widgets.d.ts +1 -2
- package/dist/checkout_widgets.js +1 -2
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +15 -15
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +354 -63
- package/dist/index.d.ts +39 -11
- package/dist/index.js +355 -64
- package/dist/passport.js +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import globalAxios$1, { HttpStatusCode as HttpStatusCode$2 } from 'axios';
|
|
2
2
|
import { ImmutableX, Config, IMXError, createStarkSigner, generateLegacyStarkPrivateKey, TransfersApi, OrdersApi as OrdersApi$1, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi as TokensApi$1 } from '@imtbl/core-sdk';
|
|
3
|
-
import { UserManager } from 'oidc-client-ts';
|
|
3
|
+
import { UserManager, WebStorageStateStore } from 'oidc-client-ts';
|
|
4
4
|
import jwt_decode from 'jwt-decode';
|
|
5
5
|
import * as crypto from 'crypto';
|
|
6
6
|
import { Magic } from 'magic-sdk';
|
|
@@ -22,6 +22,7 @@ import assert from 'assert';
|
|
|
22
22
|
import { FeeAmount, Route, SwapQuoter, Pool, Trade, toHex as toHex$1, encodeRouteToPath } from '@uniswap/v3-sdk';
|
|
23
23
|
import { keccak256 as keccak256$1 } from '@ethersproject/solidity';
|
|
24
24
|
import { SwapRouter } from '@uniswap/router-sdk';
|
|
25
|
+
import { parseUnits as parseUnits$1 } from 'ethers/lib/utils';
|
|
25
26
|
import { jsx } from 'react/jsx-runtime';
|
|
26
27
|
import { useEffect } from 'react';
|
|
27
28
|
|
|
@@ -2702,7 +2703,7 @@ class MultiRollupApiClients {
|
|
|
2702
2703
|
}
|
|
2703
2704
|
|
|
2704
2705
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2705
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.
|
|
2706
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.1' };
|
|
2706
2707
|
const createConfig = ({ basePath, headers, }) => {
|
|
2707
2708
|
if (!basePath.trim()) {
|
|
2708
2709
|
throw Error('basePath can not be empty');
|
|
@@ -2762,7 +2763,7 @@ class APIError extends Error {
|
|
|
2762
2763
|
|
|
2763
2764
|
/* eslint-disable implicit-arrow-linebreak */
|
|
2764
2765
|
const defaultHeaders = {
|
|
2765
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.
|
|
2766
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.1',
|
|
2766
2767
|
};
|
|
2767
2768
|
/**
|
|
2768
2769
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3048,7 +3049,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3048
3049
|
chainID,
|
|
3049
3050
|
coreContractAddress,
|
|
3050
3051
|
registrationContractAddress,
|
|
3051
|
-
sdkVersion: 'ts-immutable-sdk-0.18.
|
|
3052
|
+
sdkVersion: 'ts-immutable-sdk-0.18.1',
|
|
3052
3053
|
});
|
|
3053
3054
|
/**
|
|
3054
3055
|
* Sets `sdkVersion` at the time of build
|
|
@@ -7631,6 +7632,7 @@ const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
|
|
|
7631
7632
|
mergeClaims: true,
|
|
7632
7633
|
loadUserInfo: true,
|
|
7633
7634
|
scope: oidcConfiguration.scope,
|
|
7635
|
+
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
|
7634
7636
|
};
|
|
7635
7637
|
if (oidcConfiguration.audience) {
|
|
7636
7638
|
baseConfiguration.extraQueryParams = {
|
|
@@ -27733,6 +27735,8 @@ var $bc2bfebf768286d3$export$8cb0af6b2bed4b64;
|
|
|
27733
27735
|
|
|
27734
27736
|
|
|
27735
27737
|
|
|
27738
|
+
|
|
27739
|
+
|
|
27736
27740
|
var $de275b98d2b651c3$export$788b1fd17f3dad84;
|
|
27737
27741
|
(function(GasEstimateType) {
|
|
27738
27742
|
GasEstimateType["BRIDGE_TO_L2"] = "BRIDGE_TO_L2";
|
|
@@ -28138,6 +28142,12 @@ var $4b58188d47aafe8d$export$537fa3efd10ed435;
|
|
|
28138
28142
|
GasTokenType["NATIVE"] = "NATIVE";
|
|
28139
28143
|
GasTokenType["ERC20"] = "ERC20";
|
|
28140
28144
|
})($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
|
|
28145
|
+
var $4b58188d47aafe8d$export$3af78bb3e8650ee6;
|
|
28146
|
+
(function(FundingRouteType) {
|
|
28147
|
+
FundingRouteType["BRIDGE"] = "BRIDGE";
|
|
28148
|
+
FundingRouteType["ONRAMP"] = "ONRAMP";
|
|
28149
|
+
FundingRouteType["SWAP"] = "SWAP";
|
|
28150
|
+
})($4b58188d47aafe8d$export$3af78bb3e8650ee6 || ($4b58188d47aafe8d$export$3af78bb3e8650ee6 = {}));
|
|
28141
28151
|
|
|
28142
28152
|
|
|
28143
28153
|
var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
@@ -28183,6 +28193,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
|
28183
28193
|
CheckoutErrorType["EXECUTE_FULFILMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILMENT_TRANSACTION_ERROR";
|
|
28184
28194
|
CheckoutErrorType["SIGN_MESSAGE_ERROR"] = "SIGN_MESSAGE_ERROR";
|
|
28185
28195
|
CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
|
|
28196
|
+
CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
|
|
28186
28197
|
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
28187
28198
|
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
28188
28199
|
message;
|
|
@@ -29829,12 +29840,6 @@ var $b23305044c0e096a$export$3057de18ac0c076;
|
|
|
29829
29840
|
RouteCalculatorType["NO_ROUTES"] = "NO_ROUTES";
|
|
29830
29841
|
RouteCalculatorType["NO_OPTIONS"] = "NO_OPTIONS";
|
|
29831
29842
|
})($b23305044c0e096a$export$3057de18ac0c076 || ($b23305044c0e096a$export$3057de18ac0c076 = {}));
|
|
29832
|
-
var $b23305044c0e096a$export$3af78bb3e8650ee6;
|
|
29833
|
-
(function(FundingRouteType) {
|
|
29834
|
-
FundingRouteType["BRIDGE"] = "BRIDGE";
|
|
29835
|
-
FundingRouteType["ON_RAMP"] = "ONRAMP";
|
|
29836
|
-
FundingRouteType["SWAP"] = "SWAP";
|
|
29837
|
-
})($b23305044c0e096a$export$3af78bb3e8650ee6 || ($b23305044c0e096a$export$3af78bb3e8650ee6 = {}));
|
|
29838
29843
|
|
|
29839
29844
|
|
|
29840
29845
|
|
|
@@ -29894,7 +29899,6 @@ const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, readOnlyProvider
|
|
|
29894
29899
|
|
|
29895
29900
|
|
|
29896
29901
|
|
|
29897
|
-
|
|
29898
29902
|
const $f730af3b727f04ac$export$22fea095b15361de = (balances)=>{
|
|
29899
29903
|
for (const balance of balances.balances){
|
|
29900
29904
|
if (!balance.token.address || balance.token.address === "") return balance.balance;
|
|
@@ -29978,6 +29982,18 @@ const $5a5ccedc98d53d25$var$filterTokens = (allowedTokens, balances)=>{
|
|
|
29978
29982
|
});
|
|
29979
29983
|
return [];
|
|
29980
29984
|
};
|
|
29985
|
+
const $5a5ccedc98d53d25$export$9ec9fc71f3ce62c4 = async (config, availableRoutingOptions)=>{
|
|
29986
|
+
if (availableRoutingOptions.onRamp) {
|
|
29987
|
+
const onRampOptions = await config.remote.getConfig("onramp");
|
|
29988
|
+
const onRampAllowList = {};
|
|
29989
|
+
Object.entries(onRampOptions).forEach(([onRampProvider, onRampProviderConfig])=>{
|
|
29990
|
+
// Allowed list per onRamp provider
|
|
29991
|
+
onRampAllowList[onRampProvider] = onRampProviderConfig.tokens ?? [];
|
|
29992
|
+
});
|
|
29993
|
+
return onRampAllowList;
|
|
29994
|
+
}
|
|
29995
|
+
return {};
|
|
29996
|
+
};
|
|
29981
29997
|
const $5a5ccedc98d53d25$export$d744af9f1c0712bc = async (config, tokenBalances, availableRoutingOptions)=>{
|
|
29982
29998
|
if (availableRoutingOptions.bridge) {
|
|
29983
29999
|
const allowedTokens = (await config.remote.getConfig("bridge"))?.tokens ?? [];
|
|
@@ -29986,6 +30002,21 @@ const $5a5ccedc98d53d25$export$d744af9f1c0712bc = async (config, tokenBalances,
|
|
|
29986
30002
|
}
|
|
29987
30003
|
return [];
|
|
29988
30004
|
};
|
|
30005
|
+
const $5a5ccedc98d53d25$export$87ed7f956d73690 = async (config, tokenBalances, availableRoutingOptions)=>{
|
|
30006
|
+
if (availableRoutingOptions.swap) {
|
|
30007
|
+
const allowedTokens = (await config.remote.getConfig("dex"))?.tokens ?? [];
|
|
30008
|
+
const balances = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
30009
|
+
return $5a5ccedc98d53d25$var$filterTokens(allowedTokens, balances);
|
|
30010
|
+
}
|
|
30011
|
+
return [];
|
|
30012
|
+
};
|
|
30013
|
+
const $5a5ccedc98d53d25$export$1ad29657d49c5440 = async (config, tokenBalances, availableRoutingOptions)=>{
|
|
30014
|
+
const tokenAllowList = {};
|
|
30015
|
+
tokenAllowList.swap = await $5a5ccedc98d53d25$export$87ed7f956d73690(config, tokenBalances, availableRoutingOptions);
|
|
30016
|
+
tokenAllowList.bridge = await $5a5ccedc98d53d25$export$d744af9f1c0712bc(config, tokenBalances, availableRoutingOptions);
|
|
30017
|
+
tokenAllowList.onRamp = await $5a5ccedc98d53d25$export$9ec9fc71f3ce62c4(config, availableRoutingOptions);
|
|
30018
|
+
return tokenAllowList;
|
|
30019
|
+
};
|
|
29989
30020
|
|
|
29990
30021
|
|
|
29991
30022
|
const $fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665 = (balances, totalFees)=>{
|
|
@@ -30013,14 +30044,14 @@ const $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6 = async (config, balanceRequirem
|
|
|
30013
30044
|
return l1address;
|
|
30014
30045
|
};
|
|
30015
30046
|
const $fa9ac5bfdbbf9dfa$export$da05aed50d75046 = async (config, readOnlyProviders, feeEstimates)=>{
|
|
30016
|
-
let bridgeFeeEstimate = feeEstimates.get(($
|
|
30047
|
+
let bridgeFeeEstimate = feeEstimates.get(($4b58188d47aafe8d$export$3af78bb3e8650ee6).BRIDGE);
|
|
30017
30048
|
if (bridgeFeeEstimate) return bridgeFeeEstimate;
|
|
30018
30049
|
bridgeFeeEstimate = await ($8a49d1a3783a2640$export$3aff971444a4f244)(config, readOnlyProviders);
|
|
30019
|
-
feeEstimates.set(($
|
|
30050
|
+
feeEstimates.set(($4b58188d47aafe8d$export$3af78bb3e8650ee6).BRIDGE, bridgeFeeEstimate);
|
|
30020
30051
|
return bridgeFeeEstimate;
|
|
30021
30052
|
};
|
|
30022
30053
|
const $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute = (chainId, balance)=>({
|
|
30023
|
-
type: ($
|
|
30054
|
+
type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).BRIDGE,
|
|
30024
30055
|
chainId: chainId,
|
|
30025
30056
|
asset: {
|
|
30026
30057
|
balance: balance.balance,
|
|
@@ -30076,6 +30107,7 @@ const $fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa = async (config, readOnlyProvide
|
|
|
30076
30107
|
|
|
30077
30108
|
|
|
30078
30109
|
|
|
30110
|
+
|
|
30079
30111
|
async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
|
|
30080
30112
|
if (config.isProduction && existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM)) return existingReadOnlyProviders;
|
|
30081
30113
|
if (existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
|
|
@@ -30093,16 +30125,199 @@ async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnl
|
|
|
30093
30125
|
|
|
30094
30126
|
|
|
30095
30127
|
|
|
30128
|
+
|
|
30129
|
+
|
|
30130
|
+
|
|
30131
|
+
|
|
30132
|
+
|
|
30133
|
+
const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, walletAddress, requiredToken, swappableTokens)=>{
|
|
30134
|
+
const dexQuotes = new Map();
|
|
30135
|
+
try {
|
|
30136
|
+
const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
|
|
30137
|
+
const dexTransactionResponsePromises = [];
|
|
30138
|
+
// Create a quote for each swappable token
|
|
30139
|
+
for (const swappableToken of swappableTokens)dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount));
|
|
30140
|
+
// Resolve all the quotes and link them back to the swappable token
|
|
30141
|
+
// The swappable token array is in the same position in the array as the quote in the promise array
|
|
30142
|
+
const dexTransactionResponse = await Promise.all(dexTransactionResponsePromises);
|
|
30143
|
+
dexTransactionResponse.forEach((response, index)=>{
|
|
30144
|
+
const swappableToken = swappableTokens[index];
|
|
30145
|
+
dexQuotes.set(swappableToken, {
|
|
30146
|
+
quote: response.quote,
|
|
30147
|
+
approval: response.approval?.gasFeeEstimate,
|
|
30148
|
+
swap: response.swap.gasFeeEstimate
|
|
30149
|
+
});
|
|
30150
|
+
});
|
|
30151
|
+
return dexQuotes;
|
|
30152
|
+
} catch {
|
|
30153
|
+
return dexQuotes;
|
|
30154
|
+
}
|
|
30155
|
+
};
|
|
30156
|
+
|
|
30157
|
+
|
|
30158
|
+
const $3ee85f12225c19f3$export$fb80fe94a81a3132 = async (config, dexQuoteCache, walletAddress, requiredToken, swappableTokens)=>{
|
|
30159
|
+
const dexQuotes = dexQuoteCache.get(requiredToken.address);
|
|
30160
|
+
if (dexQuotes) return dexQuotes;
|
|
30161
|
+
const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
|
|
30162
|
+
dexQuoteCache.set(requiredToken.address, quotes);
|
|
30163
|
+
return quotes;
|
|
30164
|
+
};
|
|
30165
|
+
|
|
30166
|
+
|
|
30167
|
+
const $91807edfd7057288$export$85e4d8628aabb217 = (balanceRequirement)=>{
|
|
30168
|
+
let address = "";
|
|
30169
|
+
let amount = (BigNumber$1).from(0);
|
|
30170
|
+
switch(balanceRequirement.type){
|
|
30171
|
+
case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
|
|
30172
|
+
address = balanceRequirement.required.token.address ?? "";
|
|
30173
|
+
amount = balanceRequirement.delta.balance;
|
|
30174
|
+
break;
|
|
30175
|
+
case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE:
|
|
30176
|
+
address = ($d85ad1457a3f1a83$export$b80040cb173ba6e9);
|
|
30177
|
+
amount = balanceRequirement.delta.balance;
|
|
30178
|
+
break;
|
|
30179
|
+
}
|
|
30180
|
+
return {
|
|
30181
|
+
address: address,
|
|
30182
|
+
amount: amount
|
|
30183
|
+
};
|
|
30184
|
+
};
|
|
30185
|
+
const $91807edfd7057288$export$7b6318fc1a8067b3 = (l2Balances, approval)=>{
|
|
30186
|
+
// Check if approval required
|
|
30187
|
+
if (!approval) return {
|
|
30188
|
+
sufficient: true,
|
|
30189
|
+
approvalGasFee: (BigNumber$1).from(0),
|
|
30190
|
+
approvalGasTokenAddress: ""
|
|
30191
|
+
};
|
|
30192
|
+
const approvalGasFee = approval.value;
|
|
30193
|
+
const approvalGasTokenAddress = approval.token.address;
|
|
30194
|
+
// No balance on L2 to cover approval fees
|
|
30195
|
+
if (l2Balances.length === 0) return {
|
|
30196
|
+
sufficient: false,
|
|
30197
|
+
approvalGasFee: approvalGasFee,
|
|
30198
|
+
approvalGasTokenAddress: approvalGasTokenAddress
|
|
30199
|
+
};
|
|
30200
|
+
// Find the users balance of the approval token
|
|
30201
|
+
const l2BalanceOfApprovalToken = l2Balances.find((balance)=>balance.token.address === approvalGasTokenAddress);
|
|
30202
|
+
if (!l2BalanceOfApprovalToken) return {
|
|
30203
|
+
sufficient: false,
|
|
30204
|
+
approvalGasFee: approvalGasFee,
|
|
30205
|
+
approvalGasTokenAddress: approvalGasTokenAddress
|
|
30206
|
+
};
|
|
30207
|
+
// If the user does not have enough of the token to cover approval fees then return sufficient false
|
|
30208
|
+
if (l2BalanceOfApprovalToken.balance.lt(approvalGasFee)) return {
|
|
30209
|
+
sufficient: false,
|
|
30210
|
+
approvalGasFee: approvalGasFee,
|
|
30211
|
+
approvalGasTokenAddress: approvalGasTokenAddress
|
|
30212
|
+
};
|
|
30213
|
+
// The user has enough to cover approval gas fees
|
|
30214
|
+
return {
|
|
30215
|
+
sufficient: true,
|
|
30216
|
+
approvalGasFee: approvalGasFee,
|
|
30217
|
+
approvalGasTokenAddress: approvalGasTokenAddress
|
|
30218
|
+
};
|
|
30219
|
+
};
|
|
30220
|
+
const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, swapFees, approvalFees, tokenBeingSwapped)=>{
|
|
30221
|
+
// Set up a map of token addresses to amounts for each of the swap fees
|
|
30222
|
+
const feeMap = new Map();
|
|
30223
|
+
// Add the approval fee to list of fees
|
|
30224
|
+
if (approvalFees.approvalGasTokenAddress !== "") feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
|
|
30225
|
+
// Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
|
|
30226
|
+
if (tokenBeingSwapped) {
|
|
30227
|
+
const fee = feeMap.get(tokenBeingSwapped.address);
|
|
30228
|
+
if (fee) feeMap.set(tokenBeingSwapped.address, fee.add(tokenBeingSwapped.amount));
|
|
30229
|
+
else feeMap.set(tokenBeingSwapped.address, tokenBeingSwapped.amount);
|
|
30230
|
+
}
|
|
30231
|
+
// Get all the fees and key them by their token id
|
|
30232
|
+
for (const swapFee of swapFees){
|
|
30233
|
+
const fee = feeMap.get(swapFee.amount.token.address);
|
|
30234
|
+
if (fee) {
|
|
30235
|
+
feeMap.set(swapFee.amount.token.address, fee.add(swapFee.amount.value));
|
|
30236
|
+
continue;
|
|
30237
|
+
}
|
|
30238
|
+
feeMap.set(swapFee.amount.token.address, swapFee.amount.value);
|
|
30239
|
+
}
|
|
30240
|
+
// Go through the map and for each token address check if the user has enough balance to cover the fee
|
|
30241
|
+
for (const [tokenAddress, fee] of feeMap.entries()){
|
|
30242
|
+
if (fee === (BigNumber$1).from(0)) continue;
|
|
30243
|
+
const l2BalanceOfFeeToken = l2Balances.find((balance)=>balance.token.address === tokenAddress);
|
|
30244
|
+
if (!l2BalanceOfFeeToken) return false;
|
|
30245
|
+
if (l2BalanceOfFeeToken.balance.lt(fee)) return false;
|
|
30246
|
+
}
|
|
30247
|
+
return true;
|
|
30248
|
+
};
|
|
30249
|
+
const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, dexQuoteCache, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens)=>{
|
|
30250
|
+
if (!availableRoutingOptions.swap) return undefined;
|
|
30251
|
+
if (swappableTokens.length === 0) return undefined;
|
|
30252
|
+
const requiredToken = $91807edfd7057288$export$85e4d8628aabb217(balanceRequirement);
|
|
30253
|
+
if (requiredToken.address === "") return undefined;
|
|
30254
|
+
const l2TokenBalanceResult = tokenBalanceResults.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
30255
|
+
if (!l2TokenBalanceResult) return undefined;
|
|
30256
|
+
const l2Balances = l2TokenBalanceResult.balances;
|
|
30257
|
+
if (l2Balances.length === 0) return undefined;
|
|
30258
|
+
const quotes = await ($3ee85f12225c19f3$export$fb80fe94a81a3132)(config, dexQuoteCache, walletAddress, requiredToken, swappableTokens);
|
|
30259
|
+
const quoteTokenAddresses = Array.from(quotes.keys());
|
|
30260
|
+
for (const quoteTokenAddress of quoteTokenAddresses){
|
|
30261
|
+
const quote = quotes.get(quoteTokenAddress);
|
|
30262
|
+
if (!quote) continue;
|
|
30263
|
+
// Find the balance the user has for this quoted token
|
|
30264
|
+
const userBalanceOfQuotedToken = l2Balances.find((balance)=>balance.token.address === quoteTokenAddress);
|
|
30265
|
+
// If no balance found on L2 for this quoted token then continue
|
|
30266
|
+
if (!userBalanceOfQuotedToken) continue;
|
|
30267
|
+
// Check the amount of quoted token required against the user balance
|
|
30268
|
+
const amountOfQuoteTokenRequired = quote.quote.amount;
|
|
30269
|
+
// If user does not have enough balance to perform the swap with this token then continue
|
|
30270
|
+
if (userBalanceOfQuotedToken.balance.lt(amountOfQuoteTokenRequired.value)) continue;
|
|
30271
|
+
const approvalFees = $91807edfd7057288$export$7b6318fc1a8067b3(l2Balances, quote.approval);
|
|
30272
|
+
// If user does not have enough to cover approval fees then continue
|
|
30273
|
+
if (!approvalFees.sufficient) continue;
|
|
30274
|
+
// If user does not have enough to cover swap fees then continue
|
|
30275
|
+
if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, quote.quote.fees, approvalFees, {
|
|
30276
|
+
amount: amountOfQuoteTokenRequired.value,
|
|
30277
|
+
address: quoteTokenAddress
|
|
30278
|
+
})) continue;
|
|
30279
|
+
// User has sufficient funds to cover any approval and swap fees so use this token for the funding route
|
|
30280
|
+
// Currently we are not prioritising any particular token so just taking the first sufficient token
|
|
30281
|
+
return {
|
|
30282
|
+
type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).SWAP,
|
|
30283
|
+
chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
|
|
30284
|
+
asset: {
|
|
30285
|
+
balance: userBalanceOfQuotedToken.balance,
|
|
30286
|
+
formattedBalance: userBalanceOfQuotedToken.formattedBalance,
|
|
30287
|
+
token: userBalanceOfQuotedToken.token
|
|
30288
|
+
}
|
|
30289
|
+
};
|
|
30290
|
+
}
|
|
30291
|
+
return undefined;
|
|
30292
|
+
};
|
|
30293
|
+
|
|
30294
|
+
|
|
30295
|
+
|
|
30296
|
+
|
|
30297
|
+
|
|
30096
30298
|
const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
30097
30299
|
let insufficientBalanceCount = 0;
|
|
30098
|
-
let
|
|
30300
|
+
let insufficientRequirement;
|
|
30099
30301
|
for (const balanceRequirement of balanceRequirements.balanceRequirements)if (!balanceRequirement.sufficient) {
|
|
30100
30302
|
insufficientBalanceCount++;
|
|
30101
|
-
|
|
30303
|
+
insufficientRequirement = balanceRequirement;
|
|
30102
30304
|
}
|
|
30103
|
-
if (insufficientBalanceCount === 1) return
|
|
30305
|
+
if (insufficientBalanceCount === 1) return insufficientRequirement;
|
|
30104
30306
|
return undefined;
|
|
30105
30307
|
};
|
|
30308
|
+
const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList)=>{
|
|
30309
|
+
if (!availableRoutingOptions.swap) return undefined;
|
|
30310
|
+
if (insufficientRequirement === undefined) return undefined;
|
|
30311
|
+
if (swapTokenAllowList === undefined) return undefined;
|
|
30312
|
+
const tokenBalanceResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
30313
|
+
if (!tokenBalanceResult) return undefined;
|
|
30314
|
+
if (tokenBalanceResult.error !== undefined || !tokenBalanceResult.success) return undefined;
|
|
30315
|
+
if (swapTokenAllowList.length === 0) return undefined;
|
|
30316
|
+
const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
|
|
30317
|
+
if (swappableTokens.length === 0) return undefined;
|
|
30318
|
+
const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
|
|
30319
|
+
return swapFundingStep;
|
|
30320
|
+
};
|
|
30106
30321
|
const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
|
|
30107
30322
|
let readOnlyProviders;
|
|
30108
30323
|
try {
|
|
@@ -30113,40 +30328,52 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
30113
30328
|
});
|
|
30114
30329
|
}
|
|
30115
30330
|
const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
|
|
30331
|
+
const allowList = await ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions);
|
|
30116
30332
|
// Bridge and swap fee cache
|
|
30117
30333
|
const feeEstimates = new Map();
|
|
30118
|
-
//
|
|
30119
|
-
|
|
30334
|
+
// Dex quotes cache
|
|
30335
|
+
const dexQuoteCache = new Map();
|
|
30336
|
+
// Ensures only 1 balance requirement is insufficient otherwise one bridge or one swap route cannot be recommended
|
|
30120
30337
|
const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
|
|
30338
|
+
let bridgeFundingStep;
|
|
30121
30339
|
if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
|
|
30340
|
+
const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
|
|
30122
30341
|
// Check on-ramp routes
|
|
30123
30342
|
// Check swap routes
|
|
30124
30343
|
// > Could bridge first
|
|
30125
30344
|
// > Could on-ramp first
|
|
30126
30345
|
// > Could double swap
|
|
30127
|
-
|
|
30128
|
-
availableOptions: [],
|
|
30129
|
-
response: {
|
|
30130
|
-
type: ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND,
|
|
30131
|
-
message: "Routes found"
|
|
30132
|
-
},
|
|
30133
|
-
fundingRoutes: [
|
|
30134
|
-
{
|
|
30135
|
-
priority: 1,
|
|
30136
|
-
steps: [
|
|
30137
|
-
bridgeFundingStep
|
|
30138
|
-
]
|
|
30139
|
-
}
|
|
30140
|
-
]
|
|
30141
|
-
};
|
|
30142
|
-
return {
|
|
30143
|
-
availableOptions: [],
|
|
30346
|
+
const response = {
|
|
30144
30347
|
response: {
|
|
30145
30348
|
type: ($b23305044c0e096a$export$3057de18ac0c076).NO_ROUTES,
|
|
30146
30349
|
message: "Routes not found"
|
|
30147
30350
|
},
|
|
30148
30351
|
fundingRoutes: []
|
|
30149
30352
|
};
|
|
30353
|
+
let priority = 0;
|
|
30354
|
+
if (bridgeFundingStep || swapFundingStep) {
|
|
30355
|
+
response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
|
|
30356
|
+
response.response.message = "Routes found";
|
|
30357
|
+
}
|
|
30358
|
+
if (bridgeFundingStep) {
|
|
30359
|
+
priority++;
|
|
30360
|
+
response.fundingRoutes.push({
|
|
30361
|
+
priority: priority,
|
|
30362
|
+
steps: [
|
|
30363
|
+
bridgeFundingStep
|
|
30364
|
+
]
|
|
30365
|
+
});
|
|
30366
|
+
}
|
|
30367
|
+
if (swapFundingStep) {
|
|
30368
|
+
priority++;
|
|
30369
|
+
response.fundingRoutes.push({
|
|
30370
|
+
priority: priority,
|
|
30371
|
+
steps: [
|
|
30372
|
+
swapFundingStep
|
|
30373
|
+
]
|
|
30374
|
+
});
|
|
30375
|
+
}
|
|
30376
|
+
return response;
|
|
30150
30377
|
};
|
|
30151
30378
|
|
|
30152
30379
|
|
|
@@ -30470,27 +30697,80 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
|
|
|
30470
30697
|
|
|
30471
30698
|
|
|
30472
30699
|
|
|
30700
|
+
|
|
30701
|
+
|
|
30702
|
+
|
|
30703
|
+
|
|
30704
|
+
const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
|
|
30705
|
+
const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
|
|
30706
|
+
const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
|
|
30707
|
+
const feePercentage = orderFee.amount;
|
|
30708
|
+
// note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
|
|
30709
|
+
const feePercentageMultiplier = Math.round(feePercentage.percentageDecimal * 10 ** $9051cee080948594$export$768e717351d4b176);
|
|
30710
|
+
const bnFeeAmount = amountBn.mul((BigNumber$1).from(feePercentageMultiplier)).div(10 ** $9051cee080948594$export$768e717351d4b176);
|
|
30711
|
+
return bnFeeAmount;
|
|
30712
|
+
};
|
|
30713
|
+
const $9051cee080948594$var$calculateFeesToken = (orderFee, decimals)=>{
|
|
30714
|
+
const feeToken = orderFee.amount;
|
|
30715
|
+
const bnFeeAmount = (parseUnits$1)(feeToken.token, decimals);
|
|
30716
|
+
return bnFeeAmount;
|
|
30717
|
+
};
|
|
30718
|
+
const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimals = 18)=>{
|
|
30719
|
+
let totalTokenFees = (BigNumber$1).from(0);
|
|
30720
|
+
const amountBn = (BigNumber$1).from(weiAmount);
|
|
30721
|
+
// note: multiply in and out of the maximum decimal places to the power of ten to do the math in big number integers
|
|
30722
|
+
const totalAllowableFees = amountBn.mul($9051cee080948594$export$9ac1563efd38130 * 10 ** $9051cee080948594$export$768e717351d4b176).div(10 ** $9051cee080948594$export$768e717351d4b176);
|
|
30723
|
+
const calculateFeesResult = [];
|
|
30724
|
+
for (const orderFee of orderFees){
|
|
30725
|
+
let currentFeeBn = (BigNumber$1).from(0);
|
|
30726
|
+
if (Object.hasOwn(orderFee.amount, "percentageDecimal")) {
|
|
30727
|
+
currentFeeBn = $9051cee080948594$var$calculateFeesPercent(orderFee, amountBn);
|
|
30728
|
+
totalTokenFees = totalTokenFees.add(currentFeeBn);
|
|
30729
|
+
} else if (Object.hasOwn(orderFee.amount, "token")) {
|
|
30730
|
+
currentFeeBn = $9051cee080948594$var$calculateFeesToken(orderFee, decimals);
|
|
30731
|
+
totalTokenFees = totalTokenFees.add(currentFeeBn);
|
|
30732
|
+
} else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unknown fee type parsed, must be percentageDecimal or token", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
|
|
30733
|
+
if (totalTokenFees.gt(totalAllowableFees)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`The combined fees are above the allowed maximum of ${$9051cee080948594$export$9ac1563efd38130 * 100}%`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).ORDER_FEE_ERROR);
|
|
30734
|
+
if (currentFeeBn.gt(0)) calculateFeesResult.push({
|
|
30735
|
+
amount: currentFeeBn.toString(),
|
|
30736
|
+
recipient: orderFee.recipient
|
|
30737
|
+
});
|
|
30738
|
+
} // for
|
|
30739
|
+
return calculateFeesResult;
|
|
30740
|
+
};
|
|
30741
|
+
|
|
30742
|
+
|
|
30473
30743
|
const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
|
|
30474
30744
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
|
|
30475
30745
|
id: id,
|
|
30476
30746
|
contractAddress: contractAddress,
|
|
30477
30747
|
spenderAddress: spenderAddress
|
|
30478
30748
|
});
|
|
30479
|
-
const $9085b221b72ac69e$export$586d02673c66d423 = (buyToken)=>{
|
|
30749
|
+
const $9085b221b72ac69e$export$586d02673c66d423 = (buyToken, decimals = 18)=>{
|
|
30750
|
+
const bnAmount = (parseUnits$1)(buyToken.amount, decimals);
|
|
30480
30751
|
if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return {
|
|
30481
30752
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE,
|
|
30482
|
-
amount:
|
|
30753
|
+
amount: bnAmount.toString()
|
|
30483
30754
|
};
|
|
30484
30755
|
return {
|
|
30485
30756
|
type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20,
|
|
30486
|
-
amount:
|
|
30757
|
+
amount: bnAmount.toString(),
|
|
30487
30758
|
contractAddress: buyToken.contractAddress
|
|
30488
30759
|
};
|
|
30489
30760
|
};
|
|
30490
|
-
const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider,
|
|
30761
|
+
const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, orders)=>{
|
|
30491
30762
|
let orderbook;
|
|
30492
30763
|
let listing;
|
|
30493
30764
|
let spenderAddress = "";
|
|
30765
|
+
if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were parsed, must parse at least one order", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR);
|
|
30766
|
+
const { buyToken: buyToken, sellToken: sellToken, makerFees: makerFees } = orders[0];
|
|
30767
|
+
let decimals = 18;
|
|
30768
|
+
if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
|
|
30769
|
+
// get this from the allowed list
|
|
30770
|
+
const buyTokenContract = new (Contract$1)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
|
|
30771
|
+
decimals = buyTokenContract.decimals();
|
|
30772
|
+
}
|
|
30773
|
+
const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
|
|
30494
30774
|
try {
|
|
30495
30775
|
const walletAddress = await provider.getSigner().getAddress();
|
|
30496
30776
|
orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
|
|
@@ -30498,22 +30778,22 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
30498
30778
|
spenderAddress = seaportContractAddress;
|
|
30499
30779
|
listing = await orderbook.prepareListing({
|
|
30500
30780
|
makerAddress: walletAddress,
|
|
30501
|
-
buy:
|
|
30781
|
+
buy: buyTokenOrNative,
|
|
30502
30782
|
sell: {
|
|
30503
30783
|
type: (0, $4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
|
|
30504
|
-
contractAddress:
|
|
30505
|
-
tokenId: id
|
|
30784
|
+
contractAddress: sellToken.collectionAddress,
|
|
30785
|
+
tokenId: sellToken.id
|
|
30506
30786
|
}
|
|
30507
30787
|
});
|
|
30508
30788
|
} catch (err) {
|
|
30509
30789
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while preparing the listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR, {
|
|
30510
30790
|
message: err.message,
|
|
30511
|
-
id: id,
|
|
30512
|
-
collectionAddress:
|
|
30791
|
+
id: sellToken.id,
|
|
30792
|
+
collectionAddress: sellToken.collectionAddress
|
|
30513
30793
|
});
|
|
30514
30794
|
}
|
|
30515
30795
|
const itemRequirements = [
|
|
30516
|
-
$9085b221b72ac69e$export$af768ccdf17d5c04(id,
|
|
30796
|
+
$9085b221b72ac69e$export$af768ccdf17d5c04(sellToken.id, sellToken.collectionAddress, spenderAddress)
|
|
30517
30797
|
];
|
|
30518
30798
|
const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
|
|
30519
30799
|
type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
|
|
@@ -30527,15 +30807,15 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
30527
30807
|
if (!unsignedMessage) // For sell it is expected the orderbook will always return an unsigned message
|
|
30528
30808
|
// If for some reason it is missing then we cannot proceed with the create listing
|
|
30529
30809
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("The unsigned message is missing after preparing the listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).SIGN_MESSAGE_ERROR, {
|
|
30530
|
-
id: id,
|
|
30531
|
-
collectionAddress:
|
|
30810
|
+
id: sellToken.id,
|
|
30811
|
+
collectionAddress: sellToken.collectionAddress
|
|
30532
30812
|
});
|
|
30533
30813
|
const signedMessage = await ($25ac589234c10b67$export$1d9a7a8a40780de)(provider, unsignedMessage);
|
|
30534
30814
|
const unsignedTransactions = await ($a7367d01c6e76b1c$export$b087719c36e0f2dc)(listing.actions);
|
|
30535
30815
|
const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
|
|
30536
30816
|
if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
|
|
30537
|
-
id: id,
|
|
30538
|
-
collectionAddress:
|
|
30817
|
+
id: sellToken.id,
|
|
30818
|
+
collectionAddress: sellToken.collectionAddress,
|
|
30539
30819
|
smartCheckoutResult: smartCheckoutResult,
|
|
30540
30820
|
status: {
|
|
30541
30821
|
type: ($c2874b006e92b115$export$a9780122aaa0801a).FAILED,
|
|
@@ -30544,23 +30824,31 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
30544
30824
|
}
|
|
30545
30825
|
};
|
|
30546
30826
|
let orderId = "";
|
|
30827
|
+
const createListingParams = {
|
|
30828
|
+
orderComponents: signedMessage.orderComponents,
|
|
30829
|
+
orderHash: signedMessage.orderHash,
|
|
30830
|
+
orderSignature: signedMessage.signedMessage
|
|
30831
|
+
};
|
|
30832
|
+
if (makerFees !== undefined) {
|
|
30833
|
+
const orderBookFees = ($9051cee080948594$export$1e69c9cfc42e28d8)(makerFees, buyTokenOrNative.amount, decimals);
|
|
30834
|
+
// @TODO add support for an array of fees when the orderbook enables it
|
|
30835
|
+
if (orderBookFees.length !== makerFees.length) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("One of the fees is too small, must be greater than 0.000001", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CREATE_ORDER_LISTING_ERROR);
|
|
30836
|
+
const [makerFee] = orderBookFees;
|
|
30837
|
+
createListingParams.makerFee = makerFee;
|
|
30838
|
+
}
|
|
30547
30839
|
try {
|
|
30548
|
-
const order = await orderbook.createListing(
|
|
30549
|
-
orderComponents: signedMessage.orderComponents,
|
|
30550
|
-
orderHash: signedMessage.orderHash,
|
|
30551
|
-
orderSignature: signedMessage.signedMessage
|
|
30552
|
-
});
|
|
30840
|
+
const order = await orderbook.createListing(createListingParams);
|
|
30553
30841
|
orderId = order.result.id;
|
|
30554
30842
|
} catch (err) {
|
|
30555
30843
|
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while creating the listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CREATE_ORDER_LISTING_ERROR, {
|
|
30556
30844
|
message: err.message,
|
|
30557
|
-
|
|
30558
|
-
collectionAddress:
|
|
30845
|
+
collectionId: sellToken.id,
|
|
30846
|
+
collectionAddress: sellToken.collectionAddress
|
|
30559
30847
|
});
|
|
30560
30848
|
}
|
|
30561
30849
|
return {
|
|
30562
|
-
id: id,
|
|
30563
|
-
collectionAddress:
|
|
30850
|
+
id: sellToken.id,
|
|
30851
|
+
collectionAddress: sellToken.collectionAddress,
|
|
30564
30852
|
smartCheckoutResult: smartCheckoutResult,
|
|
30565
30853
|
status: {
|
|
30566
30854
|
type: ($c2874b006e92b115$export$a9780122aaa0801a).SUCCESS,
|
|
@@ -30569,8 +30857,8 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
30569
30857
|
};
|
|
30570
30858
|
}
|
|
30571
30859
|
return {
|
|
30572
|
-
id: id,
|
|
30573
|
-
collectionAddress:
|
|
30860
|
+
id: sellToken.id,
|
|
30861
|
+
collectionAddress: sellToken.collectionAddress,
|
|
30574
30862
|
smartCheckoutResult: smartCheckoutResult
|
|
30575
30863
|
};
|
|
30576
30864
|
};
|
|
@@ -30756,12 +31044,16 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
30756
31044
|
/**
|
|
30757
31045
|
* Determines the requirements for performing a sell.
|
|
30758
31046
|
* @param {SellParams} params - The parameters for the sell.
|
|
31047
|
+
* Only currently actions the first order in the array until we support batch processing.
|
|
31048
|
+
* Only currently actions the first fee in the fees array of each order until we support multiple fees.
|
|
30759
31049
|
*/ async sell(params) {
|
|
30760
31050
|
if (this.config.isProduction) throw new Error("This endpoint is not currently available.");
|
|
30761
31051
|
// eslint-disable-next-line no-console
|
|
30762
31052
|
console.warn("This endpoint is currently under construction.");
|
|
31053
|
+
if (params.orders.length > 1) // eslint-disable-next-line no-console
|
|
31054
|
+
console.warn("This endpoint currently only actions the first order in the array.");
|
|
30763
31055
|
const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
|
|
30764
|
-
await $9085b221b72ac69e$export$e761f9e0703de895(this.config, web3Provider, params.
|
|
31056
|
+
await $9085b221b72ac69e$export$e761f9e0703de895(this.config, web3Provider, params.orders);
|
|
30765
31057
|
}
|
|
30766
31058
|
/**
|
|
30767
31059
|
* Cancels a sell.
|
|
@@ -30859,7 +31151,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30859
31151
|
function $parcel$export(e, n, v, s) {
|
|
30860
31152
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
30861
31153
|
}
|
|
30862
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.
|
|
31154
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.1";
|
|
30863
31155
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30864
31156
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
30865
31157
|
|
|
@@ -31014,7 +31306,6 @@ $parcel$export($045213b18e9f1f94$exports, "CheckoutWidgetTagNames", () => $04521
|
|
|
31014
31306
|
(function(WidgetTheme) {
|
|
31015
31307
|
WidgetTheme["LIGHT"] = "light";
|
|
31016
31308
|
WidgetTheme["DARK"] = "dark";
|
|
31017
|
-
WidgetTheme["CUSTOM"] = "custom";
|
|
31018
31309
|
})($045213b18e9f1f94$export$c88931fdc51854eb || ($045213b18e9f1f94$export$c88931fdc51854eb = {}));
|
|
31019
31310
|
var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
31020
31311
|
(function(CheckoutWidgetTagNames) {
|