@imtbl/sdk 0.27.1 → 0.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11041,7 +11041,7 @@ type BuyResultSuccess = {
11041
11041
  * @property {CheckoutStatus.FAILED} status - The status to indicate failure
11042
11042
  * @property {string} transactionHash - The transaction hash of the failed transaction
11043
11043
  * @property {string} reason - The reason for the failure
11044
- * @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
11044
+ * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
11045
11045
  */
11046
11046
  type BuyResultFailed = {
11047
11047
  status: CheckoutStatus.FAILED;
@@ -12126,9 +12126,13 @@ declare class FiatRampService {
12126
12126
  feeEstimate(): Promise<OnRampProviderFees>;
12127
12127
  createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
12128
12128
  }
12129
+ type AvailabilityService = {
12130
+ checkDexAvailability: () => Promise<boolean>;
12131
+ };
12129
12132
  declare class Checkout {
12130
12133
  readonly config: CheckoutConfiguration;
12131
12134
  readonly fiatRampService: FiatRampService;
12135
+ readonly availability: AvailabilityService;
12132
12136
  /**
12133
12137
  * Constructs a new instance of the CheckoutModule class.
12134
12138
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
@@ -12246,6 +12250,11 @@ declare class Checkout {
12246
12250
  * @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
12247
12251
  */
12248
12252
  getExchangeFeeEstimate(): Promise<OnRampProviderFees>;
12253
+ /**
12254
+ * Fetches Swap widget availability.
12255
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean.
12256
+ */
12257
+ isSwapAvailable(): Promise<boolean>;
12249
12258
  }
12250
12259
 
12251
12260
  export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeFundingStep, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CHECKOUT_API_BASE_URL, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutStatus, ConnectParams, ConnectResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampFundingStep, OrderFee, RemoteConfiguration, RoutesFound, RoutingOutcome, RoutingOutcomeType, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapFundingStep, SwitchNetworkParams, SwitchNetworkResult, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
@@ -20580,7 +20580,7 @@ class APIError extends Error {
20580
20580
 
20581
20581
  /* eslint-disable implicit-arrow-linebreak */
20582
20582
  const defaultHeaders = {
20583
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.1',
20583
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.3',
20584
20584
  };
20585
20585
  /**
20586
20586
  * createAPIConfiguration to create a custom Configuration
@@ -21088,11 +21088,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
21088
21088
  decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
21089
21089
  address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
21090
21090
  };
21091
- ({
21091
+ const $d85ad1457a3f1a83$export$89133ca13c5ee30 = {
21092
21092
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
21093
21093
  [(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
21094
21094
  [(Environment$1).PRODUCTION]: "https://api.immutable.com"
21095
- });
21095
+ };
21096
21096
  const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
21097
21097
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
21098
21098
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
@@ -24820,6 +24820,35 @@ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements)
24820
24820
 
24821
24821
 
24822
24822
 
24823
+
24824
+
24825
+
24826
+
24827
+ const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=>{
24828
+ const postEndpoint = ()=>{
24829
+ if (isDevelopment) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
24830
+ if (isProduction) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).PRODUCTION];
24831
+ return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).SANDBOX];
24832
+ };
24833
+ const checkDexAvailability = async ()=>{
24834
+ let response;
24835
+ try {
24836
+ response = await (0, globalAxios).post(`${postEndpoint()}/v1/availability/checkout/swap`);
24837
+ } catch (error) {
24838
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
24839
+ }
24840
+ if (response.status === 403) return false;
24841
+ if (response.status === 204) return true;
24842
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
24843
+ };
24844
+ return {
24845
+ checkDexAvailability: checkDexAvailability
24846
+ };
24847
+ };
24848
+
24849
+
24850
+
24851
+
24823
24852
  const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
24824
24853
  baseConfig: {
24825
24854
  environment: (Environment$1).SANDBOX
@@ -24829,6 +24858,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
24829
24858
  config;
24830
24859
  fiatRampService;
24831
24860
  readOnlyProviders;
24861
+ availability;
24832
24862
  /**
24833
24863
  * Constructs a new instance of the CheckoutModule class.
24834
24864
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
@@ -24836,6 +24866,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
24836
24866
  this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
24837
24867
  this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
24838
24868
  this.readOnlyProviders = new Map();
24869
+ this.availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(this.config.isDevelopment, this.config.isProduction);
24839
24870
  }
24840
24871
  /**
24841
24872
  * Creates a provider using the given parameters.
@@ -25045,6 +25076,12 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
25045
25076
  */ async getExchangeFeeEstimate() {
25046
25077
  return await this.fiatRampService.feeEstimate();
25047
25078
  }
25079
+ /**
25080
+ * Fetches Swap widget availability.
25081
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean.
25082
+ */ async isSwapAvailable() {
25083
+ return this.availability.checkDexAvailability();
25084
+ }
25048
25085
  }
25049
25086
 
25050
25087
  export { $d85ad1457a3f1a83$export$161d4a74df65fc08 as CHECKOUT_API_BASE_URL, $0472f23319457bfb$export$c06e1e7429de6283 as ChainId, $0472f23319457bfb$export$b874c6b1dfe85e02 as ChainName, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $4b58188d47aafe8d$export$de7bcda3c490bf18 as CheckoutStatus, $e055e79256bbc1dd$export$80f4da0d409a629d as ExchangeType, $4b58188d47aafe8d$export$6fbaa98ee06d03e8 as FundingStepType, $de275b98d2b651c3$export$788b1fd17f3dad84 as GasEstimateType, $4b58188d47aafe8d$export$537fa3efd10ed435 as GasTokenType, $4b58188d47aafe8d$export$1fc8f52ad1810e52 as ItemType, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $4b58188d47aafe8d$export$d0616bd3e995b8be as RoutingOutcomeType, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $4b58188d47aafe8d$export$65c64e46348ee3c1 as TransactionOrGasType, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes, $e768639828688ca3$export$2d7a51a18d87e21d as WalletProviderName };
@@ -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.27.1";
28
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.3";
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.27.1',
19
+ sdkVersion: 'ts-immutable-sdk-0.27.3',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build