@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/index.cjs CHANGED
@@ -3555,7 +3555,7 @@ class MultiRollupApiClients {
3555
3555
  }
3556
3556
 
3557
3557
  // eslint-disable-next-line @typescript-eslint/naming-convention
3558
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.25.0' };
3558
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.26.0' };
3559
3559
  const createConfig = ({ basePath, headers, }) => {
3560
3560
  if (!basePath.trim()) {
3561
3561
  throw Error('basePath can not be empty');
@@ -3615,7 +3615,7 @@ class APIError extends Error {
3615
3615
 
3616
3616
  /* eslint-disable implicit-arrow-linebreak */
3617
3617
  const defaultHeaders = {
3618
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.25.0',
3618
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.26.0',
3619
3619
  };
3620
3620
  /**
3621
3621
  * createAPIConfiguration to create a custom Configuration
@@ -3932,6 +3932,20 @@ class BlockchainData {
3932
3932
  throw formatError(err);
3933
3933
  });
3934
3934
  }
3935
+ /**
3936
+ * Get metadata by ID
3937
+ * @param request - the request object containing the parameters to be provided in the API request
3938
+ * @returns a promise that resolves with a single Metadata
3939
+ * @throws {@link index.APIError}
3940
+ */
3941
+ async getMetadata(request) {
3942
+ return await this.metadata
3943
+ .getMetadata(request)
3944
+ .then((res) => res.data)
3945
+ .catch((err) => {
3946
+ throw formatError(err);
3947
+ });
3948
+ }
3935
3949
  /**
3936
3950
  * List NFT Metadata by contract address
3937
3951
  * @param request - the request object containing the parameters to be provided in the API request
@@ -4005,7 +4019,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4005
4019
  chainID,
4006
4020
  coreContractAddress,
4007
4021
  registrationContractAddress,
4008
- sdkVersion: 'ts-immutable-sdk-0.25.0',
4022
+ sdkVersion: 'ts-immutable-sdk-0.26.0',
4009
4023
  });
4010
4024
  /**
4011
4025
  * Sets `sdkVersion` at the time of build
@@ -28926,6 +28940,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
28926
28940
  decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
28927
28941
  address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
28928
28942
  };
28943
+ ({
28944
+ [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
28945
+ [(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
28946
+ [(Environment$1).PRODUCTION]: "https://api.immutable.com"
28947
+ });
28929
28948
  const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
28930
28949
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
28931
28950
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
@@ -29318,6 +29337,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
29318
29337
  CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
29319
29338
  CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
29320
29339
  CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
29340
+ CheckoutErrorType["API_ERROR"] = "API_ERROR";
29321
29341
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
29322
29342
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
29323
29343
  message;
@@ -29498,6 +29518,7 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
29498
29518
 
29499
29519
 
29500
29520
 
29521
+
29501
29522
  class $a492ee374ae7b613$export$d902b56530cd5f87 {
29502
29523
  isDevelopment;
29503
29524
  isProduction;
@@ -29512,9 +29533,9 @@ class $a492ee374ae7b613$export$d902b56530cd5f87 {
29512
29533
  try {
29513
29534
  response = await (0, globalAxios$1).get(url);
29514
29535
  } catch (error) {
29515
- throw new Error(`Error fetching from api: ${error.message}`);
29536
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
29516
29537
  }
29517
- if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
29538
+ if (response.status !== 200) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
29518
29539
  return response;
29519
29540
  }
29520
29541
  getEndpoint = ()=>{
@@ -31050,17 +31071,23 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
31050
31071
  try {
31051
31072
  const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
31052
31073
  const dexTransactionResponsePromises = [];
31074
+ const fromToken = [];
31053
31075
  // Create a quote for each swappable token
31054
- for (const swappableToken of swappableTokens)dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
31076
+ for (const swappableToken of swappableTokens){
31077
+ if (swappableToken === requiredToken.address) continue;
31078
+ dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
31079
+ fromToken.push(swappableToken);
31080
+ }
31055
31081
  // Resolve all the quotes and link them back to the swappable token
31056
31082
  // The swappable token array is in the same position in the array as the quote in the promise array
31057
- const dexTransactionResponse = await Promise.all(dexTransactionResponsePromises);
31083
+ const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
31058
31084
  dexTransactionResponse.forEach((response, index)=>{
31059
- const swappableToken = swappableTokens[index];
31085
+ if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
31086
+ const swappableToken = fromToken[index];
31060
31087
  dexQuotes.set(swappableToken, {
31061
- quote: response.quote,
31062
- approval: response.approval?.gasFeeEstimate,
31063
- swap: response.swap.gasFeeEstimate
31088
+ quote: response.value.quote,
31089
+ approval: response.value.approval?.gasFeeEstimate,
31090
+ swap: response.value.swap.gasFeeEstimate
31064
31091
  });
31065
31092
  });
31066
31093
  return dexQuotes;
@@ -32933,7 +32960,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
32933
32960
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
32934
32961
 
32935
32962
 
32936
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.25.0";
32963
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.26.0";
32937
32964
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
32938
32965
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
32939
32966
 
package/dist/index.d.ts CHANGED
@@ -1251,6 +1251,32 @@ interface Metadata {
1251
1251
  'attributes': Array<NFTMetadataAttribute> | null;
1252
1252
  }
1253
1253
 
1254
+ /**
1255
+ * Immutable zkEVM API
1256
+ * Immutable Multi Rollup API
1257
+ *
1258
+ * The version of the OpenAPI document: 1.0.0
1259
+ * Contact: support@immutable.com
1260
+ *
1261
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1262
+ * https://openapi-generator.tech
1263
+ * Do not edit the class manually.
1264
+ */
1265
+
1266
+ /**
1267
+ * Single metadata
1268
+ * @export
1269
+ * @interface GetMetadataResult
1270
+ */
1271
+ interface GetMetadataResult {
1272
+ /**
1273
+ *
1274
+ * @type {Metadata}
1275
+ * @memberof GetMetadataResult
1276
+ */
1277
+ 'result': Metadata;
1278
+ }
1279
+
1254
1280
  /**
1255
1281
  * Immutable zkEVM API
1256
1282
  * Immutable Multi Rollup API
@@ -2352,6 +2378,31 @@ interface CollectionsApiRefreshCollectionMetadataRequest {
2352
2378
  readonly refreshCollectionMetadataRequest: RefreshCollectionMetadataRequest;
2353
2379
  }
2354
2380
 
2381
+ /**
2382
+ * Request parameters for getMetadata operation in MetadataApi.
2383
+ * @export
2384
+ * @interface MetadataApiGetMetadataRequest
2385
+ */
2386
+ interface MetadataApiGetMetadataRequest {
2387
+ /**
2388
+ * The name of chain
2389
+ * @type {string}
2390
+ * @memberof MetadataApiGetMetadata
2391
+ */
2392
+ readonly chainName: string;
2393
+ /**
2394
+ * The address of metadata contract
2395
+ * @type {string}
2396
+ * @memberof MetadataApiGetMetadata
2397
+ */
2398
+ readonly contractAddress: string;
2399
+ /**
2400
+ * The id of the metadata
2401
+ * @type {string}
2402
+ * @memberof MetadataApiGetMetadata
2403
+ */
2404
+ readonly metadataId: string;
2405
+ }
2355
2406
  /**
2356
2407
  * Request parameters for listMetadata operation in MetadataApi.
2357
2408
  * @export
@@ -2875,6 +2926,13 @@ declare class BlockchainData {
2875
2926
  * @throws {@link index.APIError}
2876
2927
  */
2877
2928
  getToken(request: TokensApiGetERC20TokenRequest): Promise<GetTokenResult>;
2929
+ /**
2930
+ * Get metadata by ID
2931
+ * @param request - the request object containing the parameters to be provided in the API request
2932
+ * @returns a promise that resolves with a single Metadata
2933
+ * @throws {@link index.APIError}
2934
+ */
2935
+ getMetadata(request: MetadataApiGetMetadataRequest): Promise<GetMetadataResult>;
2878
2936
  /**
2879
2937
  * List NFT Metadata by contract address
2880
2938
  * @param request - the request object containing the parameters to be provided in the API request
@@ -16286,7 +16344,8 @@ declare enum CheckoutErrorType {
16286
16344
  SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
16287
16345
  BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
16288
16346
  ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
16289
- ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR"
16347
+ ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
16348
+ API_ERROR = "API_ERROR"
16290
16349
  }
16291
16350
  /**
16292
16351
  * Represents an error object with a specific type, optional message, and optional data.
package/dist/index.js CHANGED
@@ -3533,7 +3533,7 @@ class MultiRollupApiClients {
3533
3533
  }
3534
3534
 
3535
3535
  // eslint-disable-next-line @typescript-eslint/naming-convention
3536
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.25.0' };
3536
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.26.0' };
3537
3537
  const createConfig = ({ basePath, headers, }) => {
3538
3538
  if (!basePath.trim()) {
3539
3539
  throw Error('basePath can not be empty');
@@ -3593,7 +3593,7 @@ class APIError extends Error {
3593
3593
 
3594
3594
  /* eslint-disable implicit-arrow-linebreak */
3595
3595
  const defaultHeaders = {
3596
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.25.0',
3596
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.26.0',
3597
3597
  };
3598
3598
  /**
3599
3599
  * createAPIConfiguration to create a custom Configuration
@@ -3910,6 +3910,20 @@ class BlockchainData {
3910
3910
  throw formatError(err);
3911
3911
  });
3912
3912
  }
3913
+ /**
3914
+ * Get metadata by ID
3915
+ * @param request - the request object containing the parameters to be provided in the API request
3916
+ * @returns a promise that resolves with a single Metadata
3917
+ * @throws {@link index.APIError}
3918
+ */
3919
+ async getMetadata(request) {
3920
+ return await this.metadata
3921
+ .getMetadata(request)
3922
+ .then((res) => res.data)
3923
+ .catch((err) => {
3924
+ throw formatError(err);
3925
+ });
3926
+ }
3913
3927
  /**
3914
3928
  * List NFT Metadata by contract address
3915
3929
  * @param request - the request object containing the parameters to be provided in the API request
@@ -3983,7 +3997,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3983
3997
  chainID,
3984
3998
  coreContractAddress,
3985
3999
  registrationContractAddress,
3986
- sdkVersion: 'ts-immutable-sdk-0.25.0',
4000
+ sdkVersion: 'ts-immutable-sdk-0.26.0',
3987
4001
  });
3988
4002
  /**
3989
4003
  * Sets `sdkVersion` at the time of build
@@ -28904,6 +28918,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
28904
28918
  decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
28905
28919
  address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
28906
28920
  };
28921
+ ({
28922
+ [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
28923
+ [(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
28924
+ [(Environment$1).PRODUCTION]: "https://api.immutable.com"
28925
+ });
28907
28926
  const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
28908
28927
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
28909
28928
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
@@ -29296,6 +29315,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
29296
29315
  CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
29297
29316
  CheckoutErrorType["ORDER_FEE_ERROR"] = "ORDER_FEE_ERROR";
29298
29317
  CheckoutErrorType["ITEM_REQUIREMENTS_ERROR"] = "ITEM_REQUIREMENTS_ERROR";
29318
+ CheckoutErrorType["API_ERROR"] = "API_ERROR";
29299
29319
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
29300
29320
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
29301
29321
  message;
@@ -29476,6 +29496,7 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
29476
29496
 
29477
29497
 
29478
29498
 
29499
+
29479
29500
  class $a492ee374ae7b613$export$d902b56530cd5f87 {
29480
29501
  isDevelopment;
29481
29502
  isProduction;
@@ -29490,9 +29511,9 @@ class $a492ee374ae7b613$export$d902b56530cd5f87 {
29490
29511
  try {
29491
29512
  response = await (0, globalAxios$1).get(url);
29492
29513
  } catch (error) {
29493
- throw new Error(`Error fetching from api: ${error.message}`);
29514
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
29494
29515
  }
29495
- if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
29516
+ if (response.status !== 200) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
29496
29517
  return response;
29497
29518
  }
29498
29519
  getEndpoint = ()=>{
@@ -31028,17 +31049,23 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
31028
31049
  try {
31029
31050
  const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
31030
31051
  const dexTransactionResponsePromises = [];
31052
+ const fromToken = [];
31031
31053
  // Create a quote for each swappable token
31032
- for (const swappableToken of swappableTokens)dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
31054
+ for (const swappableToken of swappableTokens){
31055
+ if (swappableToken === requiredToken.address) continue;
31056
+ dexTransactionResponsePromises.push(exchange.getUnsignedSwapTxFromAmountOut(walletAddress, swappableToken, requiredToken.address, requiredToken.amount, slippagePercent));
31057
+ fromToken.push(swappableToken);
31058
+ }
31033
31059
  // Resolve all the quotes and link them back to the swappable token
31034
31060
  // The swappable token array is in the same position in the array as the quote in the promise array
31035
- const dexTransactionResponse = await Promise.all(dexTransactionResponsePromises);
31061
+ const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
31036
31062
  dexTransactionResponse.forEach((response, index)=>{
31037
- const swappableToken = swappableTokens[index];
31063
+ if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
31064
+ const swappableToken = fromToken[index];
31038
31065
  dexQuotes.set(swappableToken, {
31039
- quote: response.quote,
31040
- approval: response.approval?.gasFeeEstimate,
31041
- swap: response.swap.gasFeeEstimate
31066
+ quote: response.value.quote,
31067
+ approval: response.value.approval?.gasFeeEstimate,
31068
+ swap: response.value.swap.gasFeeEstimate
31042
31069
  });
31043
31070
  });
31044
31071
  return dexQuotes;
@@ -32911,7 +32938,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
32911
32938
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
32912
32939
 
32913
32940
 
32914
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.25.0";
32941
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.26.0";
32915
32942
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
32916
32943
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
32917
32944
 
package/dist/passport.js CHANGED
@@ -2067,7 +2067,7 @@ class MultiRollupApiClients {
2067
2067
  }
2068
2068
 
2069
2069
  // eslint-disable-next-line @typescript-eslint/naming-convention
2070
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.25.0' };
2070
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.26.0' };
2071
2071
  const createConfig = ({ basePath, headers, }) => {
2072
2072
  if (!basePath.trim()) {
2073
2073
  throw Error('basePath can not be empty');
@@ -2123,7 +2123,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2123
2123
  chainID,
2124
2124
  coreContractAddress,
2125
2125
  registrationContractAddress,
2126
- sdkVersion: 'ts-immutable-sdk-0.25.0',
2126
+ sdkVersion: 'ts-immutable-sdk-0.26.0',
2127
2127
  });
2128
2128
  /**
2129
2129
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.25.0",
4
+ "version": "0.26.0",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",