@imtbl/sdk 0.36.5 → 0.38.0
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/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +58 -58
- package/dist/checkout.d.ts +633 -194
- package/dist/checkout.js +222 -106
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +3 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +227 -110
- package/dist/index.d.ts +510 -66
- package/dist/index.js +227 -110
- package/dist/passport.js +2 -2
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ class ImmutableConfiguration {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const API_KEY_PREFIX = 'sk_imapik-';
|
|
42
|
-
const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
|
|
42
|
+
const PUBLISHABLE_KEY_PREFIX$1 = 'pk_imapik-';
|
|
43
43
|
const addApiKeyToAxiosHeader = (apiKey) => {
|
|
44
44
|
if (!apiKey.startsWith(API_KEY_PREFIX)) {
|
|
45
45
|
throw new Error('Invalid API key. Create your api key in Immutable developer hub. https://hub.immutable.com');
|
|
@@ -47,7 +47,7 @@ const addApiKeyToAxiosHeader = (apiKey) => {
|
|
|
47
47
|
globalAxios$1.defaults.headers.common['x-immutable-api-key'] = apiKey;
|
|
48
48
|
};
|
|
49
49
|
const addPublishableKeyToAxiosHeader = (publishableKey) => {
|
|
50
|
-
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX)) {
|
|
50
|
+
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX$1)) {
|
|
51
51
|
throw new Error('Invalid Publishable key. Create your Publishable key in Immutable developer hub.'
|
|
52
52
|
+ ' https://hub.immutable.com');
|
|
53
53
|
}
|
|
@@ -4234,7 +4234,7 @@ class MultiRollupApiClients {
|
|
|
4234
4234
|
}
|
|
4235
4235
|
|
|
4236
4236
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4237
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
4237
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.38.0' };
|
|
4238
4238
|
const createConfig = ({ basePath, headers, }) => {
|
|
4239
4239
|
if (!basePath.trim()) {
|
|
4240
4240
|
throw Error('basePath can not be empty');
|
|
@@ -4294,7 +4294,7 @@ class APIError extends Error {
|
|
|
4294
4294
|
|
|
4295
4295
|
/* eslint-disable implicit-arrow-linebreak */
|
|
4296
4296
|
const defaultHeaders = {
|
|
4297
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
4297
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.38.0',
|
|
4298
4298
|
};
|
|
4299
4299
|
/**
|
|
4300
4300
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4733,7 +4733,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4733
4733
|
chainID,
|
|
4734
4734
|
coreContractAddress,
|
|
4735
4735
|
registrationContractAddress,
|
|
4736
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4736
|
+
sdkVersion: 'ts-immutable-sdk-0.38.0',
|
|
4737
4737
|
});
|
|
4738
4738
|
/**
|
|
4739
4739
|
* Sets `sdkVersion` at the time of build
|
|
@@ -12232,13 +12232,13 @@ var ProtocolData;
|
|
|
12232
12232
|
})(ProtocolData.order_type || (ProtocolData.order_type = {}));
|
|
12233
12233
|
})(ProtocolData || (ProtocolData = {}));
|
|
12234
12234
|
|
|
12235
|
-
var FeeType;
|
|
12235
|
+
var FeeType$1;
|
|
12236
12236
|
(function (FeeType) {
|
|
12237
12237
|
FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
12238
12238
|
FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
12239
12239
|
FeeType["PROTOCOL"] = "PROTOCOL";
|
|
12240
12240
|
FeeType["ROYALTY"] = "ROYALTY";
|
|
12241
|
-
})(FeeType || (FeeType = {}));
|
|
12241
|
+
})(FeeType$1 || (FeeType$1 = {}));
|
|
12242
12242
|
var TransactionPurpose;
|
|
12243
12243
|
(function (TransactionPurpose) {
|
|
12244
12244
|
TransactionPurpose["APPROVAL"] = "APPROVAL";
|
|
@@ -12800,7 +12800,7 @@ class ImmutableApiClient {
|
|
|
12800
12800
|
],
|
|
12801
12801
|
fees: makerFees.map((x) => ({
|
|
12802
12802
|
amount: x.amount,
|
|
12803
|
-
type: FeeType.MAKER_ECOSYSTEM,
|
|
12803
|
+
type: FeeType$1.MAKER_ECOSYSTEM,
|
|
12804
12804
|
recipient_address: x.recipientAddress,
|
|
12805
12805
|
})),
|
|
12806
12806
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
@@ -13014,7 +13014,7 @@ class Orderbook {
|
|
|
13014
13014
|
order_id: listingId,
|
|
13015
13015
|
fees: takerFees.map((fee) => ({
|
|
13016
13016
|
amount: fee.amount,
|
|
13017
|
-
type: FeeType.TAKER_ECOSYSTEM,
|
|
13017
|
+
type: FeeType$1.TAKER_ECOSYSTEM,
|
|
13018
13018
|
recipient_address: fee.recipientAddress,
|
|
13019
13019
|
})),
|
|
13020
13020
|
},
|
|
@@ -13037,7 +13037,7 @@ class Orderbook {
|
|
|
13037
13037
|
order_id: listingRequest.listingId,
|
|
13038
13038
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
13039
13039
|
amount: fee.amount,
|
|
13040
|
-
type: FeeType.TAKER_ECOSYSTEM,
|
|
13040
|
+
type: FeeType$1.TAKER_ECOSYSTEM,
|
|
13041
13041
|
recipient_address: fee.recipientAddress,
|
|
13042
13042
|
})),
|
|
13043
13043
|
})));
|
|
@@ -13168,7 +13168,7 @@ const constants = {
|
|
|
13168
13168
|
var orderbook = /*#__PURE__*/Object.freeze({
|
|
13169
13169
|
__proto__: null,
|
|
13170
13170
|
get ActionType () { return ActionType; },
|
|
13171
|
-
get FeeType () { return FeeType; },
|
|
13171
|
+
get FeeType () { return FeeType$1; },
|
|
13172
13172
|
get OrderStatusName () { return OrderStatusName; },
|
|
13173
13173
|
Orderbook: Orderbook,
|
|
13174
13174
|
get SignablePurpose () { return SignablePurpose; },
|
|
@@ -34780,6 +34780,7 @@ var ConnectEventType;
|
|
|
34780
34780
|
ConnectEventType["CLOSE_WIDGET"] = "close-widget";
|
|
34781
34781
|
ConnectEventType["SUCCESS"] = "success";
|
|
34782
34782
|
ConnectEventType["FAILURE"] = "failure";
|
|
34783
|
+
ConnectEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
34783
34784
|
})(ConnectEventType || (ConnectEventType = {}));
|
|
34784
34785
|
|
|
34785
34786
|
/**
|
|
@@ -34790,6 +34791,7 @@ var WalletEventType;
|
|
|
34790
34791
|
WalletEventType["CLOSE_WIDGET"] = "close-widget";
|
|
34791
34792
|
WalletEventType["NETWORK_SWITCH"] = "network-switch";
|
|
34792
34793
|
WalletEventType["DISCONNECT_WALLET"] = "disconnect-wallet";
|
|
34794
|
+
WalletEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
34793
34795
|
})(WalletEventType || (WalletEventType = {}));
|
|
34794
34796
|
|
|
34795
34797
|
/**
|
|
@@ -34801,6 +34803,7 @@ var SwapEventType;
|
|
|
34801
34803
|
SwapEventType["SUCCESS"] = "success";
|
|
34802
34804
|
SwapEventType["FAILURE"] = "failure";
|
|
34803
34805
|
SwapEventType["REJECTED"] = "rejected";
|
|
34806
|
+
SwapEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
34804
34807
|
})(SwapEventType || (SwapEventType = {}));
|
|
34805
34808
|
|
|
34806
34809
|
/**
|
|
@@ -34813,6 +34816,7 @@ var SaleEventType;
|
|
|
34813
34816
|
SaleEventType["FAILURE"] = "failure";
|
|
34814
34817
|
SaleEventType["REJECTED"] = "rejected";
|
|
34815
34818
|
SaleEventType["TRANSACTION_SUCCESS"] = "transaction-success";
|
|
34819
|
+
SaleEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
34816
34820
|
})(SaleEventType || (SaleEventType = {}));
|
|
34817
34821
|
|
|
34818
34822
|
/**
|
|
@@ -34823,6 +34827,7 @@ var BridgeEventType;
|
|
|
34823
34827
|
BridgeEventType["CLOSE_WIDGET"] = "close-widget";
|
|
34824
34828
|
BridgeEventType["FAILURE"] = "failure";
|
|
34825
34829
|
BridgeEventType["TRANSACTION_SENT"] = "transaction-sent";
|
|
34830
|
+
BridgeEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
34826
34831
|
})(BridgeEventType || (BridgeEventType = {}));
|
|
34827
34832
|
|
|
34828
34833
|
/**
|
|
@@ -34845,6 +34850,7 @@ var OnRampEventType;
|
|
|
34845
34850
|
OnRampEventType["CLOSE_WIDGET"] = "close-widget";
|
|
34846
34851
|
OnRampEventType["SUCCESS"] = "success";
|
|
34847
34852
|
OnRampEventType["FAILURE"] = "failure";
|
|
34853
|
+
OnRampEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
34848
34854
|
})(OnRampEventType || (OnRampEventType = {}));
|
|
34849
34855
|
|
|
34850
34856
|
/**
|
|
@@ -35053,6 +35059,21 @@ var RoutingOutcomeType;
|
|
|
35053
35059
|
RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
|
|
35054
35060
|
RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
|
|
35055
35061
|
})(RoutingOutcomeType || (RoutingOutcomeType = {}));
|
|
35062
|
+
/**
|
|
35063
|
+
* An enum representing the funding step types
|
|
35064
|
+
* @enum {string}
|
|
35065
|
+
* @property {string} GAS - If the fee is a gas fee.
|
|
35066
|
+
* @property {string} BRIDGE_FEE - If the fee is a bridge fee.
|
|
35067
|
+
* @property {string} SWAP_FEE - If the fee is a swap fee.
|
|
35068
|
+
* @property {string} IMMUTABLE_FEE - If the fee is an immutable fee.
|
|
35069
|
+
*/
|
|
35070
|
+
var FeeType;
|
|
35071
|
+
(function (FeeType) {
|
|
35072
|
+
FeeType["GAS"] = "GAS";
|
|
35073
|
+
FeeType["BRIDGE_FEE"] = "BRIDGE_FEE";
|
|
35074
|
+
FeeType["SWAP_FEE"] = "SWAP_FEE";
|
|
35075
|
+
FeeType["IMMUTABLE_FEE"] = "IMMUTABLE_FEE";
|
|
35076
|
+
})(FeeType || (FeeType = {}));
|
|
35056
35077
|
/**
|
|
35057
35078
|
* An enum representing the funding step types
|
|
35058
35079
|
* @enum {string}
|
|
@@ -35658,32 +35679,21 @@ const GAS_OVERRIDES = {
|
|
|
35658
35679
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
35659
35680
|
};
|
|
35660
35681
|
|
|
35661
|
-
const SDK_VERSION_MARKER = '0.
|
|
35682
|
+
const SDK_VERSION_MARKER = '0.38.0';
|
|
35662
35683
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35663
35684
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35664
35685
|
|
|
35665
35686
|
class RemoteConfigFetcher {
|
|
35687
|
+
httpClient;
|
|
35666
35688
|
isDevelopment;
|
|
35667
35689
|
isProduction;
|
|
35668
35690
|
configCache;
|
|
35669
35691
|
tokensCache;
|
|
35670
35692
|
version = 'v1';
|
|
35671
|
-
constructor(params) {
|
|
35693
|
+
constructor(httpClient, params) {
|
|
35672
35694
|
this.isDevelopment = params.isDevelopment;
|
|
35673
35695
|
this.isProduction = params.isProduction;
|
|
35674
|
-
|
|
35675
|
-
static async makeHttpRequest(url) {
|
|
35676
|
-
let response;
|
|
35677
|
-
try {
|
|
35678
|
-
response = await globalAxios$1.get(url);
|
|
35679
|
-
}
|
|
35680
|
-
catch (error) {
|
|
35681
|
-
throw new CheckoutError(`Error fetching from api: ${error.message}`, CheckoutErrorType.API_ERROR);
|
|
35682
|
-
}
|
|
35683
|
-
if (response.status !== 200) {
|
|
35684
|
-
throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
|
|
35685
|
-
}
|
|
35686
|
-
return response;
|
|
35696
|
+
this.httpClient = httpClient;
|
|
35687
35697
|
}
|
|
35688
35698
|
getEndpoint = () => {
|
|
35689
35699
|
if (this.isDevelopment)
|
|
@@ -35695,14 +35705,14 @@ class RemoteConfigFetcher {
|
|
|
35695
35705
|
async loadConfig() {
|
|
35696
35706
|
if (this.configCache)
|
|
35697
35707
|
return this.configCache;
|
|
35698
|
-
const response = await
|
|
35708
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
|
|
35699
35709
|
this.configCache = response.data;
|
|
35700
35710
|
return this.configCache;
|
|
35701
35711
|
}
|
|
35702
35712
|
async loadConfigTokens() {
|
|
35703
35713
|
if (this.tokensCache)
|
|
35704
35714
|
return this.tokensCache;
|
|
35705
|
-
const response = await
|
|
35715
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
|
|
35706
35716
|
this.tokensCache = response.data;
|
|
35707
35717
|
return this.tokensCache;
|
|
35708
35718
|
}
|
|
@@ -35720,6 +35730,7 @@ class RemoteConfigFetcher {
|
|
|
35720
35730
|
return {};
|
|
35721
35731
|
return config[chainId] ?? [];
|
|
35722
35732
|
}
|
|
35733
|
+
getHttpClient = () => this.httpClient;
|
|
35723
35734
|
}
|
|
35724
35735
|
|
|
35725
35736
|
class CheckoutConfigurationError extends Error {
|
|
@@ -35770,7 +35781,7 @@ class CheckoutConfiguration {
|
|
|
35770
35781
|
remote;
|
|
35771
35782
|
environment;
|
|
35772
35783
|
networkMap;
|
|
35773
|
-
constructor(config) {
|
|
35784
|
+
constructor(config, httpClient) {
|
|
35774
35785
|
if (!Object.values(Environment$1).includes(config.baseConfig.environment)) {
|
|
35775
35786
|
throw new CheckoutConfigurationError('Invalid checkout configuration of environment');
|
|
35776
35787
|
}
|
|
@@ -35781,7 +35792,7 @@ class CheckoutConfiguration {
|
|
|
35781
35792
|
this.isSwapEnabled = config.swap?.enable ?? DEFAULT_SWAP_ENABLED;
|
|
35782
35793
|
this.isBridgeEnabled = config.bridge?.enable ?? DEFAULT_BRIDGE_ENABLED;
|
|
35783
35794
|
this.networkMap = networkMap(this.isProduction, this.isDevelopment);
|
|
35784
|
-
this.remote = new RemoteConfigFetcher({
|
|
35795
|
+
this.remote = new RemoteConfigFetcher(httpClient, {
|
|
35785
35796
|
isDevelopment: this.isDevelopment,
|
|
35786
35797
|
isProduction: this.isProduction,
|
|
35787
35798
|
});
|
|
@@ -35846,9 +35857,7 @@ class Blockscout {
|
|
|
35846
35857
|
ttl;
|
|
35847
35858
|
chainId;
|
|
35848
35859
|
cacheMap;
|
|
35849
|
-
|
|
35850
|
-
return globalAxios$1.get(url);
|
|
35851
|
-
}
|
|
35860
|
+
httpClient;
|
|
35852
35861
|
setCache(key, data) {
|
|
35853
35862
|
this.cacheMap[key] = { data, ttl: new Date().getTime() + this.ttl * 1000 };
|
|
35854
35863
|
}
|
|
@@ -35860,11 +35869,13 @@ class Blockscout {
|
|
|
35860
35869
|
}
|
|
35861
35870
|
/**
|
|
35862
35871
|
* Blockscout constructor
|
|
35872
|
+
* @param httpClient Client used for http requests
|
|
35863
35873
|
* @param chainId target chain
|
|
35864
35874
|
* @param ttl cache TTL
|
|
35865
35875
|
*/
|
|
35866
|
-
constructor(
|
|
35867
|
-
this.
|
|
35876
|
+
constructor(httpClient, chainId, ttl) {
|
|
35877
|
+
this.httpClient = httpClient;
|
|
35878
|
+
this.chainId = chainId;
|
|
35868
35879
|
this.url = BLOCKSCOUT_CHAIN_URL_MAP[this.chainId].url;
|
|
35869
35880
|
const native = BLOCKSCOUT_CHAIN_URL_MAP[this.chainId].nativeToken;
|
|
35870
35881
|
this.nativeToken = {
|
|
@@ -35874,7 +35885,7 @@ class Blockscout {
|
|
|
35874
35885
|
symbol: native.symbol,
|
|
35875
35886
|
};
|
|
35876
35887
|
this.cacheMap = {};
|
|
35877
|
-
this.ttl =
|
|
35888
|
+
this.ttl = ttl !== undefined ? ttl : CACHE_DATA_TTL;
|
|
35878
35889
|
}
|
|
35879
35890
|
/**
|
|
35880
35891
|
* isChainSupported verifies if the chain is supported by Blockscout
|
|
@@ -35902,7 +35913,7 @@ class Blockscout {
|
|
|
35902
35913
|
const cached = this.getCache(url);
|
|
35903
35914
|
if (cached)
|
|
35904
35915
|
return Promise.resolve(cached);
|
|
35905
|
-
const response = await
|
|
35916
|
+
const response = await this.httpClient.get(url);
|
|
35906
35917
|
if (response.status >= 400) {
|
|
35907
35918
|
return Promise.reject({
|
|
35908
35919
|
code: response.status,
|
|
@@ -35943,7 +35954,7 @@ class Blockscout {
|
|
|
35943
35954
|
const cached = this.getCache(url);
|
|
35944
35955
|
if (cached)
|
|
35945
35956
|
return Promise.resolve(cached);
|
|
35946
|
-
const response = await
|
|
35957
|
+
const response = await this.httpClient.get(url);
|
|
35947
35958
|
if (response.status >= 400) {
|
|
35948
35959
|
return Promise.reject({
|
|
35949
35960
|
code: response.status,
|
|
@@ -36028,7 +36039,7 @@ const blockscoutClientMap = new Map();
|
|
|
36028
36039
|
// This function is a utility function that can be used to reset the
|
|
36029
36040
|
// blockscout map and therefore clear all the cache.
|
|
36030
36041
|
const resetBlockscoutClientMap = () => blockscoutClientMap.clear();
|
|
36031
|
-
const getIndexerBalance = async (walletAddress, chainId, filterTokens) => {
|
|
36042
|
+
const getIndexerBalance = async (config, walletAddress, chainId, filterTokens) => {
|
|
36032
36043
|
// Shuffle the mapping of the tokens configuration so it is a hashmap
|
|
36033
36044
|
// for faster access to tokens config objects.
|
|
36034
36045
|
const shouldFilter = filterTokens !== undefined;
|
|
@@ -36036,7 +36047,8 @@ const getIndexerBalance = async (walletAddress, chainId, filterTokens) => {
|
|
|
36036
36047
|
// Get blockscout client for the given chain
|
|
36037
36048
|
let blockscoutClient = blockscoutClientMap.get(chainId);
|
|
36038
36049
|
if (!blockscoutClient) {
|
|
36039
|
-
|
|
36050
|
+
const httpClient = config.remote.getHttpClient();
|
|
36051
|
+
blockscoutClient = new Blockscout(httpClient, chainId);
|
|
36040
36052
|
blockscoutClientMap.set(chainId, blockscoutClient);
|
|
36041
36053
|
}
|
|
36042
36054
|
// Hold the items in an array for post-fetching processing
|
|
@@ -36171,7 +36183,7 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
36171
36183
|
const isL1Chain = getL1ChainId(config) === chainId;
|
|
36172
36184
|
if (!address)
|
|
36173
36185
|
address = await web3Provider?.getSigner().getAddress();
|
|
36174
|
-
return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(address, chainId, isL1Chain ? tokens : undefined));
|
|
36186
|
+
return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(config, address, chainId, isL1Chain ? tokens : undefined));
|
|
36175
36187
|
}
|
|
36176
36188
|
if (!web3Provider) {
|
|
36177
36189
|
throw new CheckoutError('indexer is disabled for this chain, you must provide a provider.', CheckoutErrorType.MISSING_PARAMS);
|
|
@@ -36552,8 +36564,8 @@ const erc20ItemAggregator = (itemRequirements) => {
|
|
|
36552
36564
|
aggregatedItemRequirements.push(itemRequirement);
|
|
36553
36565
|
return;
|
|
36554
36566
|
}
|
|
36555
|
-
const {
|
|
36556
|
-
const key = `${
|
|
36567
|
+
const { tokenAddress, spenderAddress, amount } = itemRequirement;
|
|
36568
|
+
const key = `${tokenAddress}${spenderAddress}`;
|
|
36557
36569
|
const aggregateItem = aggregatedMap.get(key);
|
|
36558
36570
|
if (aggregateItem && aggregateItem.type === ItemType.ERC20) {
|
|
36559
36571
|
aggregateItem.amount = BigNumber$1.from(aggregateItem.amount).add(amount);
|
|
@@ -36619,10 +36631,10 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36619
36631
|
for (const itemRequirement of itemRequirements) {
|
|
36620
36632
|
if (itemRequirement.type !== ItemType.ERC20)
|
|
36621
36633
|
continue;
|
|
36622
|
-
const {
|
|
36623
|
-
const key = `${
|
|
36634
|
+
const { tokenAddress, spenderAddress } = itemRequirement;
|
|
36635
|
+
const key = `${tokenAddress}${spenderAddress}`;
|
|
36624
36636
|
erc20s.set(key, itemRequirement);
|
|
36625
|
-
allowancePromises.set(key, getERC20Allowance(provider, ownerAddress,
|
|
36637
|
+
allowancePromises.set(key, getERC20Allowance(provider, ownerAddress, tokenAddress, spenderAddress));
|
|
36626
36638
|
}
|
|
36627
36639
|
const allowances = await Promise.all(allowancePromises.values());
|
|
36628
36640
|
const allowancePromiseIds = Array.from(allowancePromises.keys());
|
|
@@ -36641,8 +36653,8 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36641
36653
|
continue;
|
|
36642
36654
|
}
|
|
36643
36655
|
sufficient = false; // Set sufficient false on the root of the return object when an ERC20 is insufficient
|
|
36644
|
-
const {
|
|
36645
|
-
const key = `${
|
|
36656
|
+
const { tokenAddress, spenderAddress } = itemRequirement;
|
|
36657
|
+
const key = `${tokenAddress}${spenderAddress}`;
|
|
36646
36658
|
const delta = itemRequirement.amount.sub(allowances[index]);
|
|
36647
36659
|
// Create maps for both the insufficient ERC20 data and the transaction promises using the same key so the results can be merged
|
|
36648
36660
|
insufficientERC20s.set(key, {
|
|
@@ -36652,7 +36664,7 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36652
36664
|
itemRequirement,
|
|
36653
36665
|
approvalTransaction: undefined,
|
|
36654
36666
|
});
|
|
36655
|
-
transactionPromises.set(key, getERC20ApprovalTransaction(provider, ownerAddress,
|
|
36667
|
+
transactionPromises.set(key, getERC20ApprovalTransaction(provider, ownerAddress, tokenAddress, spenderAddress, delta));
|
|
36656
36668
|
}
|
|
36657
36669
|
// Resolves the approval transactions and merges them with the insufficient ERC20 data
|
|
36658
36670
|
const transactions = await Promise.all(transactionPromises.values());
|
|
@@ -36837,8 +36849,8 @@ const erc20BalanceAggregator = (itemRequirements) => {
|
|
|
36837
36849
|
aggregatedItemRequirements.push(itemRequirement);
|
|
36838
36850
|
return;
|
|
36839
36851
|
}
|
|
36840
|
-
const {
|
|
36841
|
-
const key = `${
|
|
36852
|
+
const { tokenAddress, amount } = itemRequirement;
|
|
36853
|
+
const key = `${tokenAddress}`;
|
|
36842
36854
|
const aggregateItem = aggregatedMap.get(key);
|
|
36843
36855
|
if (aggregateItem && aggregateItem.type === ItemType.ERC20) {
|
|
36844
36856
|
aggregateItem.amount = BigNumber$1.from(aggregateItem.amount).add(amount);
|
|
@@ -36871,14 +36883,21 @@ const balanceAggregator = (itemRequirements) => erc721BalanceAggregator(erc20Bal
|
|
|
36871
36883
|
/* eslint-disable arrow-body-style */
|
|
36872
36884
|
const getTokensFromRequirements = (itemRequirements) => itemRequirements
|
|
36873
36885
|
.map((itemRequirement) => {
|
|
36874
|
-
|
|
36875
|
-
|
|
36876
|
-
|
|
36877
|
-
|
|
36886
|
+
switch (itemRequirement.type) {
|
|
36887
|
+
case ItemType.ERC20:
|
|
36888
|
+
return {
|
|
36889
|
+
address: itemRequirement.tokenAddress,
|
|
36890
|
+
};
|
|
36891
|
+
case ItemType.NATIVE:
|
|
36892
|
+
return {
|
|
36893
|
+
address: NATIVE,
|
|
36894
|
+
};
|
|
36895
|
+
case ItemType.ERC721:
|
|
36896
|
+
default:
|
|
36897
|
+
return {
|
|
36898
|
+
address: itemRequirement.contractAddress,
|
|
36899
|
+
};
|
|
36878
36900
|
}
|
|
36879
|
-
return {
|
|
36880
|
-
address: itemRequirement.contractAddress,
|
|
36881
|
-
};
|
|
36882
36901
|
});
|
|
36883
36902
|
/**
|
|
36884
36903
|
* Gets the balance requirement with delta for an ERC721 requirement.
|
|
@@ -36928,7 +36947,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
36928
36947
|
// Get the requirements related balance
|
|
36929
36948
|
if (itemRequirement.type === ItemType.ERC20) {
|
|
36930
36949
|
itemBalanceResult = balances.find((balance) => {
|
|
36931
|
-
return balance.token?.address === itemRequirement.
|
|
36950
|
+
return balance.token?.address === itemRequirement.tokenAddress;
|
|
36932
36951
|
});
|
|
36933
36952
|
}
|
|
36934
36953
|
else if (itemRequirement.type === ItemType.NATIVE) {
|
|
@@ -36992,7 +37011,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
36992
37011
|
token: {
|
|
36993
37012
|
name,
|
|
36994
37013
|
symbol,
|
|
36995
|
-
address: itemRequirement.
|
|
37014
|
+
address: itemRequirement.tokenAddress,
|
|
36996
37015
|
decimals,
|
|
36997
37016
|
},
|
|
36998
37017
|
};
|
|
@@ -37151,7 +37170,7 @@ const getGasItemRequirement = (gas, transactionOrGas) => {
|
|
|
37151
37170
|
return {
|
|
37152
37171
|
type: ItemType.ERC20,
|
|
37153
37172
|
amount: gas,
|
|
37154
|
-
|
|
37173
|
+
tokenAddress: transactionOrGas.gasToken.tokenAddress,
|
|
37155
37174
|
spenderAddress: '',
|
|
37156
37175
|
};
|
|
37157
37176
|
};
|
|
@@ -37374,36 +37393,37 @@ const quoteFetcher = async (config, chainId, walletAddress, requiredToken, swapp
|
|
|
37374
37393
|
}
|
|
37375
37394
|
};
|
|
37376
37395
|
|
|
37377
|
-
const constructFees$1 = (
|
|
37396
|
+
const constructFees$1 = (approvalGasFee, swapGasFee, swapFees) => {
|
|
37378
37397
|
let approvalGasFeeAmount = BigNumber$1.from(0);
|
|
37379
37398
|
let approvalGasFeeFormatted = '0';
|
|
37380
37399
|
let approvalToken;
|
|
37381
|
-
if (
|
|
37382
|
-
approvalGasFeeAmount =
|
|
37383
|
-
approvalGasFeeFormatted = utils$2.formatUnits(
|
|
37400
|
+
if (approvalGasFee) {
|
|
37401
|
+
approvalGasFeeAmount = approvalGasFee.value;
|
|
37402
|
+
approvalGasFeeFormatted = utils$2.formatUnits(approvalGasFee.value, approvalGasFee.token.decimals);
|
|
37384
37403
|
approvalToken = {
|
|
37385
|
-
name:
|
|
37386
|
-
symbol:
|
|
37387
|
-
address:
|
|
37388
|
-
decimals:
|
|
37404
|
+
name: approvalGasFee.token.name ?? '',
|
|
37405
|
+
symbol: approvalGasFee.token.symbol ?? '',
|
|
37406
|
+
address: approvalGasFee.token.address,
|
|
37407
|
+
decimals: approvalGasFee.token.decimals,
|
|
37389
37408
|
};
|
|
37390
37409
|
}
|
|
37391
37410
|
let swapGasFeeAmount = BigNumber$1.from(0);
|
|
37392
37411
|
let swapGasFeeFormatted = '0';
|
|
37393
37412
|
let swapGasToken;
|
|
37394
|
-
if (
|
|
37395
|
-
swapGasFeeAmount =
|
|
37396
|
-
swapGasFeeFormatted = utils$2.formatUnits(
|
|
37413
|
+
if (swapGasFee) {
|
|
37414
|
+
swapGasFeeAmount = swapGasFee.value;
|
|
37415
|
+
swapGasFeeFormatted = utils$2.formatUnits(swapGasFee.value, swapGasFee.token.decimals);
|
|
37397
37416
|
swapGasToken = {
|
|
37398
|
-
name:
|
|
37399
|
-
symbol:
|
|
37400
|
-
address:
|
|
37401
|
-
decimals:
|
|
37417
|
+
name: swapGasFee.token.name ?? '',
|
|
37418
|
+
symbol: swapGasFee.token.symbol ?? '',
|
|
37419
|
+
address: swapGasFee.token.address,
|
|
37420
|
+
decimals: swapGasFee.token.decimals,
|
|
37402
37421
|
};
|
|
37403
37422
|
}
|
|
37404
37423
|
const fees = [];
|
|
37405
37424
|
for (const swapFee of swapFees) {
|
|
37406
37425
|
fees.push({
|
|
37426
|
+
type: FeeType.SWAP_FEE,
|
|
37407
37427
|
amount: swapFee.amount.value,
|
|
37408
37428
|
formattedAmount: utils$2.formatUnits(swapFee.amount.value, swapFee.amount.token.decimals),
|
|
37409
37429
|
token: {
|
|
@@ -37415,12 +37435,14 @@ const constructFees$1 = (approvalGasFees, swapGasFees, swapFees) => {
|
|
|
37415
37435
|
});
|
|
37416
37436
|
}
|
|
37417
37437
|
return {
|
|
37418
|
-
|
|
37438
|
+
approvalGasFee: {
|
|
37439
|
+
type: FeeType.GAS,
|
|
37419
37440
|
amount: approvalGasFeeAmount,
|
|
37420
37441
|
formattedAmount: approvalGasFeeFormatted,
|
|
37421
37442
|
token: approvalToken,
|
|
37422
37443
|
},
|
|
37423
|
-
|
|
37444
|
+
swapGasFee: {
|
|
37445
|
+
type: FeeType.GAS,
|
|
37424
37446
|
amount: swapGasFeeAmount,
|
|
37425
37447
|
formattedAmount: swapGasFeeFormatted,
|
|
37426
37448
|
token: swapGasToken,
|
|
@@ -37505,7 +37527,7 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
|
|
|
37505
37527
|
// The user has enough to cover approval gas fees
|
|
37506
37528
|
return { sufficient: true, approvalGasFee, approvalGasTokenAddress };
|
|
37507
37529
|
};
|
|
37508
|
-
const checkUserCanCoverSwapFees = (l2Balances, approvalFees,
|
|
37530
|
+
const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFee, swapFees, tokenBeingSwapped) => {
|
|
37509
37531
|
// Set up a map of token addresses to amounts for each of the swap fees
|
|
37510
37532
|
const feeMap = new Map();
|
|
37511
37533
|
// Add the approval fee to list of fees
|
|
@@ -37513,13 +37535,13 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
|
|
|
37513
37535
|
feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
|
|
37514
37536
|
}
|
|
37515
37537
|
// Add the swap gas fee to list of fees
|
|
37516
|
-
if (
|
|
37517
|
-
const fee = feeMap.get(
|
|
37538
|
+
if (swapGasFee) {
|
|
37539
|
+
const fee = feeMap.get(swapGasFee.token.address);
|
|
37518
37540
|
if (fee) {
|
|
37519
|
-
feeMap.set(
|
|
37541
|
+
feeMap.set(swapGasFee.token.address, fee.add(swapGasFee.value));
|
|
37520
37542
|
}
|
|
37521
37543
|
else {
|
|
37522
|
-
feeMap.set(
|
|
37544
|
+
feeMap.set(swapGasFee.token.address, swapGasFee.value);
|
|
37523
37545
|
}
|
|
37524
37546
|
}
|
|
37525
37547
|
// Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
|
|
@@ -37773,31 +37795,39 @@ const hasSufficientL1Eth = (tokenBalanceResult, totalFees) => {
|
|
|
37773
37795
|
const balance = getEthBalance(tokenBalanceResult);
|
|
37774
37796
|
return balance.gte(totalFees);
|
|
37775
37797
|
};
|
|
37776
|
-
const constructFees = (
|
|
37798
|
+
const constructFees = (bridgeGasFee, bridgeFee, imtblFee, approvalGasFee, token) => {
|
|
37777
37799
|
const bridgeFeeDecimals = token?.decimals ?? DEFAULT_TOKEN_DECIMALS$1;
|
|
37800
|
+
const bridgeFees = [];
|
|
37801
|
+
if (bridgeFee.gt(0)) {
|
|
37802
|
+
bridgeFees.push({
|
|
37803
|
+
type: FeeType.BRIDGE_FEE,
|
|
37804
|
+
amount: bridgeFee,
|
|
37805
|
+
formattedAmount: utils$2.formatUnits(bridgeFee, bridgeFeeDecimals),
|
|
37806
|
+
token,
|
|
37807
|
+
});
|
|
37808
|
+
}
|
|
37809
|
+
if (imtblFee.gt(0)) {
|
|
37810
|
+
bridgeFees.push({
|
|
37811
|
+
type: FeeType.IMMUTABLE_FEE,
|
|
37812
|
+
amount: imtblFee,
|
|
37813
|
+
formattedAmount: utils$2.formatUnits(imtblFee, bridgeFeeDecimals),
|
|
37814
|
+
token,
|
|
37815
|
+
});
|
|
37816
|
+
}
|
|
37778
37817
|
return {
|
|
37779
|
-
|
|
37780
|
-
|
|
37781
|
-
|
|
37818
|
+
approvalGasFee: {
|
|
37819
|
+
type: FeeType.GAS,
|
|
37820
|
+
amount: approvalGasFee,
|
|
37821
|
+
formattedAmount: utils$2.formatUnits(approvalGasFee, DEFAULT_TOKEN_DECIMALS$1),
|
|
37782
37822
|
token,
|
|
37783
37823
|
},
|
|
37784
|
-
|
|
37785
|
-
|
|
37786
|
-
|
|
37824
|
+
bridgeGasFee: {
|
|
37825
|
+
type: FeeType.GAS,
|
|
37826
|
+
amount: bridgeGasFee,
|
|
37827
|
+
formattedAmount: utils$2.formatUnits(bridgeGasFee, DEFAULT_TOKEN_DECIMALS$1),
|
|
37787
37828
|
token,
|
|
37788
37829
|
},
|
|
37789
|
-
bridgeFees
|
|
37790
|
-
{
|
|
37791
|
-
amount: bridgeFee,
|
|
37792
|
-
formattedAmount: utils$2.formatUnits(bridgeFee, bridgeFeeDecimals),
|
|
37793
|
-
token,
|
|
37794
|
-
},
|
|
37795
|
-
{
|
|
37796
|
-
amount: imtblFee,
|
|
37797
|
-
formattedAmount: utils$2.formatUnits(imtblFee, bridgeFeeDecimals),
|
|
37798
|
-
token,
|
|
37799
|
-
},
|
|
37800
|
-
],
|
|
37830
|
+
bridgeFees,
|
|
37801
37831
|
};
|
|
37802
37832
|
};
|
|
37803
37833
|
const constructBridgeFundingRoute = (chainId, balance, bridgeRequirement, itemType, fees) => ({
|
|
@@ -38656,13 +38686,13 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
|
38656
38686
|
return calculateFeesResult;
|
|
38657
38687
|
};
|
|
38658
38688
|
|
|
38659
|
-
const getItemRequirement = (type,
|
|
38689
|
+
const getItemRequirement = (type, tokenAddress, amount, spenderAddress) => {
|
|
38660
38690
|
switch (type) {
|
|
38661
38691
|
case ItemType.ERC20:
|
|
38662
38692
|
return {
|
|
38663
38693
|
type,
|
|
38664
38694
|
amount,
|
|
38665
|
-
|
|
38695
|
+
tokenAddress,
|
|
38666
38696
|
spenderAddress,
|
|
38667
38697
|
};
|
|
38668
38698
|
case ItemType.NATIVE:
|
|
@@ -38885,7 +38915,7 @@ const getBuyToken = (buyToken, decimals = 18) => {
|
|
|
38885
38915
|
return {
|
|
38886
38916
|
type: ItemType.ERC20,
|
|
38887
38917
|
amount: bnAmount.toString(),
|
|
38888
|
-
contractAddress: buyToken.
|
|
38918
|
+
contractAddress: buyToken.tokenAddress,
|
|
38889
38919
|
};
|
|
38890
38920
|
};
|
|
38891
38921
|
const sell = async (config, provider, orders) => {
|
|
@@ -38899,7 +38929,7 @@ const sell = async (config, provider, orders) => {
|
|
|
38899
38929
|
let decimals = 18;
|
|
38900
38930
|
if (buyToken.type === ItemType.ERC20) {
|
|
38901
38931
|
// get this from the allowed list
|
|
38902
|
-
const buyTokenContract = new Contract$1(buyToken.
|
|
38932
|
+
const buyTokenContract = new Contract$1(buyToken.tokenAddress, JSON.stringify(ERC20ABI), provider);
|
|
38903
38933
|
decimals = await measureAsyncExecution(config, 'Time to get decimals of token contract for the buy token', buyTokenContract.decimals());
|
|
38904
38934
|
}
|
|
38905
38935
|
const buyTokenOrNative = getBuyToken(buyToken, decimals);
|
|
@@ -39051,8 +39081,8 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
39051
39081
|
const decimalPromises = [];
|
|
39052
39082
|
requirements.forEach((itemRequirementParam) => {
|
|
39053
39083
|
if (itemRequirementParam.type === ItemType.ERC20) {
|
|
39054
|
-
const {
|
|
39055
|
-
decimalPromises.push(getTokenContract(
|
|
39084
|
+
const { tokenAddress } = itemRequirementParam;
|
|
39085
|
+
decimalPromises.push(getTokenContract(tokenAddress, ERC20ABI, provider).decimals());
|
|
39056
39086
|
}
|
|
39057
39087
|
});
|
|
39058
39088
|
const decimals = await Promise.all(decimalPromises);
|
|
@@ -39146,6 +39176,90 @@ function loadUnresolved(version) {
|
|
|
39146
39176
|
return { loaded: false, element: tag };
|
|
39147
39177
|
}
|
|
39148
39178
|
|
|
39179
|
+
const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
|
|
39180
|
+
const publishableKeyDomainAllowlist = [
|
|
39181
|
+
'https://checkout-api.dev.immutable.com',
|
|
39182
|
+
'https://checkout-api.sandbox.immutable.com',
|
|
39183
|
+
'https://checkout-api.immutable.com',
|
|
39184
|
+
];
|
|
39185
|
+
class HttpClient {
|
|
39186
|
+
config;
|
|
39187
|
+
axiosInstance;
|
|
39188
|
+
constructor(config) {
|
|
39189
|
+
this.config = config;
|
|
39190
|
+
this.axiosInstance = globalAxios$1.create();
|
|
39191
|
+
this.setupInterceptors();
|
|
39192
|
+
}
|
|
39193
|
+
// eslint-disable-next-line class-methods-use-this
|
|
39194
|
+
shouldAddPublishableKey(url) {
|
|
39195
|
+
// Check if the request is going to a whitelisted domain
|
|
39196
|
+
return publishableKeyDomainAllowlist.some((domain) => url.startsWith(domain));
|
|
39197
|
+
}
|
|
39198
|
+
setupInterceptors() {
|
|
39199
|
+
this.axiosInstance.interceptors.request.use((config) => {
|
|
39200
|
+
const publishableKey = this.config?.baseConfig?.publishableKey;
|
|
39201
|
+
if (publishableKey && this.shouldAddPublishableKey(config.url || '')) {
|
|
39202
|
+
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX)) {
|
|
39203
|
+
throw new Error('Invalid Publishable key. Create your Publishable key in Immutable developer hub.'
|
|
39204
|
+
+ ' https://hub.immutable.com');
|
|
39205
|
+
}
|
|
39206
|
+
// Add publishable key header for whitelisted domains
|
|
39207
|
+
// eslint-disable-next-line no-param-reassign
|
|
39208
|
+
config.headers['x-immutable-publishable-key'] = publishableKey;
|
|
39209
|
+
}
|
|
39210
|
+
return config;
|
|
39211
|
+
}, (error) => Promise.reject(error));
|
|
39212
|
+
}
|
|
39213
|
+
// eslint-disable-next-line class-methods-use-this
|
|
39214
|
+
processResponse(response) {
|
|
39215
|
+
if (response && response?.status !== 200) {
|
|
39216
|
+
throw new CheckoutError(`Error: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
|
|
39217
|
+
}
|
|
39218
|
+
}
|
|
39219
|
+
async request(config) {
|
|
39220
|
+
let response;
|
|
39221
|
+
try {
|
|
39222
|
+
response = await this.axiosInstance.request(config);
|
|
39223
|
+
}
|
|
39224
|
+
catch (error) {
|
|
39225
|
+
throw new CheckoutError(error.message, CheckoutErrorType.API_ERROR);
|
|
39226
|
+
}
|
|
39227
|
+
this.processResponse(response);
|
|
39228
|
+
return response;
|
|
39229
|
+
}
|
|
39230
|
+
async get(url, config) {
|
|
39231
|
+
const requestConfig = {
|
|
39232
|
+
...config,
|
|
39233
|
+
url,
|
|
39234
|
+
};
|
|
39235
|
+
return await this.request(requestConfig);
|
|
39236
|
+
}
|
|
39237
|
+
async post(url, data, config) {
|
|
39238
|
+
const requestConfig = {
|
|
39239
|
+
...config,
|
|
39240
|
+
data,
|
|
39241
|
+
url,
|
|
39242
|
+
};
|
|
39243
|
+
return await this.request(requestConfig);
|
|
39244
|
+
}
|
|
39245
|
+
async put(url, data, config) {
|
|
39246
|
+
const requestConfig = {
|
|
39247
|
+
...config,
|
|
39248
|
+
data,
|
|
39249
|
+
url,
|
|
39250
|
+
};
|
|
39251
|
+
return await this.request(requestConfig);
|
|
39252
|
+
}
|
|
39253
|
+
async delete(url, data, config) {
|
|
39254
|
+
const requestConfig = {
|
|
39255
|
+
...config,
|
|
39256
|
+
data,
|
|
39257
|
+
url,
|
|
39258
|
+
};
|
|
39259
|
+
return await this.request(requestConfig);
|
|
39260
|
+
}
|
|
39261
|
+
}
|
|
39262
|
+
|
|
39149
39263
|
const SANDBOX_CONFIGURATION = {
|
|
39150
39264
|
baseConfig: {
|
|
39151
39265
|
environment: Environment$1.SANDBOX,
|
|
@@ -39156,6 +39270,7 @@ const WIDGETS_SCRIPT_TIMEOUT = 100;
|
|
|
39156
39270
|
// Checkout SDK
|
|
39157
39271
|
class Checkout {
|
|
39158
39272
|
readOnlyProviders;
|
|
39273
|
+
httpClient;
|
|
39159
39274
|
config;
|
|
39160
39275
|
fiatRampService;
|
|
39161
39276
|
availability;
|
|
@@ -39165,7 +39280,8 @@ class Checkout {
|
|
|
39165
39280
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
39166
39281
|
*/
|
|
39167
39282
|
constructor(config = SANDBOX_CONFIGURATION) {
|
|
39168
|
-
this.
|
|
39283
|
+
this.httpClient = new HttpClient(config);
|
|
39284
|
+
this.config = new CheckoutConfiguration(config, this.httpClient);
|
|
39169
39285
|
this.fiatRampService = new FiatRampService(this.config);
|
|
39170
39286
|
this.readOnlyProviders = new Map();
|
|
39171
39287
|
this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
|
|
@@ -39367,7 +39483,7 @@ class Checkout {
|
|
|
39367
39483
|
try {
|
|
39368
39484
|
itemRequirements = await getItemRequirementsFromRequirements(web3Provider, params.itemRequirements);
|
|
39369
39485
|
}
|
|
39370
|
-
catch {
|
|
39486
|
+
catch (error) {
|
|
39371
39487
|
throw new CheckoutError('Failed to map item requirements', CheckoutErrorType.ITEM_REQUIREMENTS_ERROR);
|
|
39372
39488
|
}
|
|
39373
39489
|
return await smartCheckout(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
|
|
@@ -39448,6 +39564,7 @@ var checkout = /*#__PURE__*/Object.freeze({
|
|
|
39448
39564
|
get ConnectEventType () { return ConnectEventType; },
|
|
39449
39565
|
get ConnectTargetLayer () { return ConnectTargetLayer; },
|
|
39450
39566
|
get ExchangeType () { return ExchangeType; },
|
|
39567
|
+
get FeeType () { return FeeType; },
|
|
39451
39568
|
get FundingStepType () { return FundingStepType; },
|
|
39452
39569
|
get GasEstimateType () { return GasEstimateType; },
|
|
39453
39570
|
get GasTokenType () { return GasTokenType; },
|