@imtbl/sdk 0.27.2-alpha → 0.27.4

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.
@@ -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 };
@@ -20409,7 +20409,7 @@ class APIError extends Error {
20409
20409
 
20410
20410
  /* eslint-disable implicit-arrow-linebreak */
20411
20411
  const defaultHeaders = {
20412
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.2-alpha',
20412
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.4',
20413
20413
  };
20414
20414
  /**
20415
20415
  * createAPIConfiguration to create a custom Configuration
@@ -20917,11 +20917,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
20917
20917
  decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
20918
20918
  address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
20919
20919
  };
20920
- ({
20920
+ const $d85ad1457a3f1a83$export$89133ca13c5ee30 = {
20921
20921
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
20922
20922
  [(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
20923
20923
  [(Environment$1).PRODUCTION]: "https://api.immutable.com"
20924
- });
20924
+ };
20925
20925
  const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
20926
20926
  [$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
20927
20927
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
@@ -24649,6 +24649,35 @@ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements)
24649
24649
 
24650
24650
 
24651
24651
 
24652
+
24653
+
24654
+
24655
+
24656
+ const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=>{
24657
+ const postEndpoint = ()=>{
24658
+ if (isDevelopment) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
24659
+ if (isProduction) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).PRODUCTION];
24660
+ return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).SANDBOX];
24661
+ };
24662
+ const checkDexAvailability = async ()=>{
24663
+ let response;
24664
+ try {
24665
+ response = await (0, globalAxios).post(`${postEndpoint()}/v1/availability/checkout/swap`);
24666
+ } catch (error) {
24667
+ response = error.response;
24668
+ }
24669
+ if (response.status === 403) return false;
24670
+ if (response.status === 204) return true;
24671
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
24672
+ };
24673
+ return {
24674
+ checkDexAvailability: checkDexAvailability
24675
+ };
24676
+ };
24677
+
24678
+
24679
+
24680
+
24652
24681
  const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
24653
24682
  baseConfig: {
24654
24683
  environment: (Environment$1).SANDBOX
@@ -24658,6 +24687,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
24658
24687
  config;
24659
24688
  fiatRampService;
24660
24689
  readOnlyProviders;
24690
+ availability;
24661
24691
  /**
24662
24692
  * Constructs a new instance of the CheckoutModule class.
24663
24693
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
@@ -24665,6 +24695,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
24665
24695
  this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
24666
24696
  this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
24667
24697
  this.readOnlyProviders = new Map();
24698
+ this.availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(this.config.isDevelopment, this.config.isProduction);
24668
24699
  }
24669
24700
  /**
24670
24701
  * Creates a provider using the given parameters.
@@ -24874,6 +24905,12 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
24874
24905
  */ async getExchangeFeeEstimate() {
24875
24906
  return await this.fiatRampService.feeEstimate();
24876
24907
  }
24908
+ /**
24909
+ * Fetches Swap widget availability.
24910
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean.
24911
+ */ async isSwapAvailable() {
24912
+ return this.availability.checkDexAvailability();
24913
+ }
24877
24914
  }
24878
24915
 
24879
24916
  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.2-alpha";
28
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.4";
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.2-alpha',
19
+ sdkVersion: 'ts-immutable-sdk-0.27.4',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build