@imtbl/sdk 0.25.0 → 0.26.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.d.ts +58 -0
- package/dist/blockchain_data.js +15 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +2 -1
- package/dist/checkout_sdk.js +36 -9
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +10 -10
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +39 -12
- package/dist/index.d.ts +60 -1
- package/dist/index.js +39 -12
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -12092,7 +12092,8 @@ declare enum CheckoutErrorType {
|
|
|
12092
12092
|
SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
|
|
12093
12093
|
BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
|
|
12094
12094
|
ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
|
|
12095
|
-
ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR"
|
|
12095
|
+
ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
|
|
12096
|
+
API_ERROR = "API_ERROR"
|
|
12096
12097
|
}
|
|
12097
12098
|
/**
|
|
12098
12099
|
* Represents an error object with a specific type, optional message, and optional data.
|
package/dist/checkout_sdk.js
CHANGED
|
@@ -20461,7 +20461,7 @@ class APIError extends Error {
|
|
|
20461
20461
|
|
|
20462
20462
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20463
20463
|
const defaultHeaders = {
|
|
20464
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
20464
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.26.0',
|
|
20465
20465
|
};
|
|
20466
20466
|
/**
|
|
20467
20467
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -20778,6 +20778,20 @@ class BlockchainData {
|
|
|
20778
20778
|
throw formatError(err);
|
|
20779
20779
|
});
|
|
20780
20780
|
}
|
|
20781
|
+
/**
|
|
20782
|
+
* Get metadata by ID
|
|
20783
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
20784
|
+
* @returns a promise that resolves with a single Metadata
|
|
20785
|
+
* @throws {@link index.APIError}
|
|
20786
|
+
*/
|
|
20787
|
+
async getMetadata(request) {
|
|
20788
|
+
return await this.metadata
|
|
20789
|
+
.getMetadata(request)
|
|
20790
|
+
.then((res) => res.data)
|
|
20791
|
+
.catch((err) => {
|
|
20792
|
+
throw formatError(err);
|
|
20793
|
+
});
|
|
20794
|
+
}
|
|
20781
20795
|
/**
|
|
20782
20796
|
* List NFT Metadata by contract address
|
|
20783
20797
|
* @param request - the request object containing the parameters to be provided in the API request
|
|
@@ -20955,6 +20969,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
|
|
|
20955
20969
|
decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
|
|
20956
20970
|
address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
|
|
20957
20971
|
};
|
|
20972
|
+
({
|
|
20973
|
+
[$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
|
|
20974
|
+
[(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
|
|
20975
|
+
[(Environment$1).PRODUCTION]: "https://api.immutable.com"
|
|
20976
|
+
});
|
|
20958
20977
|
const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
|
|
20959
20978
|
[$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
|
|
20960
20979
|
[(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
|
|
@@ -21347,6 +21366,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
|
21347
21366
|
CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
|
|
21348
21367
|
CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
|
|
21349
21368
|
CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
|
|
21369
|
+
CheckoutErrorType["API_ERROR"] = "API_ERROR";
|
|
21350
21370
|
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
21351
21371
|
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
21352
21372
|
message;
|
|
@@ -21527,6 +21547,7 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
|
|
|
21527
21547
|
|
|
21528
21548
|
|
|
21529
21549
|
|
|
21550
|
+
|
|
21530
21551
|
class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
21531
21552
|
isDevelopment;
|
|
21532
21553
|
isProduction;
|
|
@@ -21541,9 +21562,9 @@ class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
|
21541
21562
|
try {
|
|
21542
21563
|
response = await (0, globalAxios).get(url);
|
|
21543
21564
|
} catch (error) {
|
|
21544
|
-
throw new
|
|
21565
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
|
|
21545
21566
|
}
|
|
21546
|
-
if (response.status !== 200) throw new
|
|
21567
|
+
if (response.status !== 200) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
|
|
21547
21568
|
return response;
|
|
21548
21569
|
}
|
|
21549
21570
|
getEndpoint = ()=>{
|
|
@@ -23079,17 +23100,23 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
|
|
|
23079
23100
|
try {
|
|
23080
23101
|
const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
|
|
23081
23102
|
const dexTransactionResponsePromises = [];
|
|
23103
|
+
const fromToken = [];
|
|
23082
23104
|
// Create a quote for each swappable token
|
|
23083
|
-
for (const swappableToken of swappableTokens)
|
|
23105
|
+
for (const swappableToken of swappableTokens){
|
|
23106
|
+
if (swappableToken === requiredToken.address) continue;
|
|
23107
|
+
dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
|
|
23108
|
+
fromToken.push(swappableToken);
|
|
23109
|
+
}
|
|
23084
23110
|
// Resolve all the quotes and link them back to the swappable token
|
|
23085
23111
|
// The swappable token array is in the same position in the array as the quote in the promise array
|
|
23086
|
-
const dexTransactionResponse = await Promise.
|
|
23112
|
+
const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
|
|
23087
23113
|
dexTransactionResponse.forEach((response, index)=>{
|
|
23088
|
-
|
|
23114
|
+
if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
|
|
23115
|
+
const swappableToken = fromToken[index];
|
|
23089
23116
|
dexQuotes.set(swappableToken, {
|
|
23090
|
-
quote: response.quote,
|
|
23091
|
-
approval: response.approval?.gasFeeEstimate,
|
|
23092
|
-
swap: response.swap.gasFeeEstimate
|
|
23117
|
+
quote: response.value.quote,
|
|
23118
|
+
approval: response.value.approval?.gasFeeEstimate,
|
|
23119
|
+
swap: response.value.swap.gasFeeEstimate
|
|
23093
23120
|
});
|
|
23094
23121
|
});
|
|
23095
23122
|
return dexQuotes;
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
25
25
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.
|
|
28
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.26.0";
|
|
29
29
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30
30
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31
31
|
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.26.0',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|