@imtbl/sdk 0.36.5 → 0.37.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.
@@ -10916,15 +10916,15 @@ type NativeBuyToken = {
10916
10916
  * Represents a ERC20 buy token
10917
10917
  * @property {ItemType} type
10918
10918
  * @property {string} amount
10919
- * @property {string} contractAddress
10919
+ * @property {string} tokenAddress
10920
10920
  */
10921
10921
  type ERC20BuyToken = {
10922
10922
  /** The type indicate this is a ERC20 token. */
10923
10923
  type: ItemType.ERC20;
10924
10924
  /** The amount of native token. */
10925
10925
  amount: string;
10926
- /** The contract address of the ERC20. */
10927
- contractAddress: string;
10926
+ /** The token address of the ERC20. */
10927
+ tokenAddress: string;
10928
10928
  };
10929
10929
  /**
10930
10930
  * The SellToken type
@@ -10965,16 +10965,16 @@ type NativeItemRequirement = {
10965
10965
  /**
10966
10966
  * Represents an ERC20 item requirement for a transaction.
10967
10967
  * @property {ItemType.ERC20} type
10968
+ * @property {string} tokenAddress
10968
10969
  * @property {string} amount
10969
- * @property {string} contractAddress
10970
10970
  * @property {string} spenderAddress
10971
10971
  */
10972
10972
  type ERC20ItemRequirement = {
10973
10973
  /** The type to indicate this is a ERC20 item requirement. */
10974
10974
  type: ItemType.ERC20;
10975
+ /** The token address of the ERC20. */
10976
+ tokenAddress: string;
10975
10977
  /** The amount of the item. */
10976
- contractAddress: string;
10977
- /** The contract address of the ERC20. */
10978
10978
  amount: string;
10979
10979
  /** The contract address of the approver. */
10980
10980
  spenderAddress: string;
@@ -11068,14 +11068,14 @@ type NativeGas = {
11068
11068
  /**
11069
11069
  * Represents an ERC20 gas token.
11070
11070
  * @property {GasTokenType} type
11071
- * @property {string} contractAddress
11071
+ * @property {string} tokenAddress
11072
11072
  * @property {BigNumber} limit
11073
11073
  */
11074
11074
  type ERC20Gas = {
11075
11075
  /** The type to indicate this is an ERC20 gas token. */
11076
11076
  type: GasTokenType.ERC20;
11077
- /** The contract address of the ERC20. */
11078
- contractAddress: string;
11077
+ /** The token address of the ERC20. */
11078
+ tokenAddress: string;
11079
11079
  /** The gas limit. */
11080
11080
  limit: BigNumber;
11081
11081
  };
@@ -11183,6 +11183,8 @@ type FundingRoute = {
11183
11183
  * @property {TokenInfo | undefined} token
11184
11184
  */
11185
11185
  type Fee = {
11186
+ /** The type of fee */
11187
+ type: FeeType;
11186
11188
  /** The amount of the fee */
11187
11189
  amount: BigNumber;
11188
11190
  /** The formatted amount of the fee */
@@ -11190,6 +11192,20 @@ type Fee = {
11190
11192
  /** The token info for the fee */
11191
11193
  token?: TokenInfo;
11192
11194
  };
11195
+ /**
11196
+ * An enum representing the funding step types
11197
+ * @enum {string}
11198
+ * @property {string} GAS - If the fee is a gas fee.
11199
+ * @property {string} BRIDGE_FEE - If the fee is a bridge fee.
11200
+ * @property {string} SWAP_FEE - If the fee is a swap fee.
11201
+ * @property {string} IMMUTABLE_FEE - If the fee is an immutable fee.
11202
+ */
11203
+ declare enum FeeType {
11204
+ GAS = "GAS",
11205
+ BRIDGE_FEE = "BRIDGE_FEE",
11206
+ SWAP_FEE = "SWAP_FEE",
11207
+ IMMUTABLE_FEE = "IMMUTABLE_FEE"
11208
+ }
11193
11209
  type FundingStep = BridgeFundingStep | SwapFundingStep | OnRampFundingStep;
11194
11210
  /**
11195
11211
  * Represents a bridge funding route
@@ -11210,15 +11226,15 @@ type BridgeFundingStep = {
11210
11226
  };
11211
11227
  /**
11212
11228
  * Represents the fees for a bridge funding step
11213
- * @property {Fee} approvalGasFees
11214
- * @property {Fee} bridgeGasFees
11229
+ * @property {Fee} approvalGasFee
11230
+ * @property {Fee} bridgeGasFee
11215
11231
  * @property {Fee[]} bridgeFees
11216
11232
  */
11217
11233
  type BridgeFees = {
11218
- /** The approval gas fees for the bridge */
11219
- approvalGasFees: Fee;
11220
- /** The bridge gas fees for the bridge */
11221
- bridgeGasFees: Fee;
11234
+ /** The approval gas fee for the bridge */
11235
+ approvalGasFee: Fee;
11236
+ /** The bridge gas fee for the bridge */
11237
+ bridgeGasFee: Fee;
11222
11238
  /** Additional bridge fees for the bridge */
11223
11239
  bridgeFees: Fee[];
11224
11240
  };
@@ -11241,15 +11257,15 @@ type SwapFundingStep = {
11241
11257
  };
11242
11258
  /**
11243
11259
  * Represents the fees for a swap funding step
11244
- * @property {Fee} approvalGasFees
11245
- * @property {Fee} swapGasFees
11260
+ * @property {Fee} approvalGasFee
11261
+ * @property {Fee} swapGasFee
11246
11262
  * @property {Fee[]} swapFees
11247
11263
  */
11248
11264
  type SwapFees = {
11249
- /** The approval gas fees for the swap */
11250
- approvalGasFees: Fee;
11251
- /** The swap gas fees for the swap */
11252
- swapGasFees: Fee;
11265
+ /** The approval gas fee for the swap */
11266
+ approvalGasFee: Fee;
11267
+ /** The swap gas fee for the swap */
11268
+ swapGasFee: Fee;
11253
11269
  /** Additional swap fees for the swap */
11254
11270
  swapFees: Fee[];
11255
11271
  };
@@ -13028,4 +13044,4 @@ type ErrorType = {
13028
13044
  };
13029
13045
  };
13030
13046
 
13031
- export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeTransactionSent, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, ChainSlug, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutBridgeConfiguration, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutOnRampConfiguration, CheckoutStatus, CheckoutSwapConfiguration, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, CreateProviderParams, CreateProviderResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, Fee, 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, GetTokenInfoParams, GetWalletAllowListParams, GetWalletAllowListResult, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
13047
+ export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeTransactionSent, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, ChainSlug, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutBridgeConfiguration, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutOnRampConfiguration, CheckoutStatus, CheckoutSwapConfiguration, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, CreateProviderParams, CreateProviderResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, Fee, FeePercentage, FeeToken, FeeType, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetTokenInfoParams, GetWalletAllowListParams, GetWalletAllowListResult, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
package/dist/checkout.js CHANGED
@@ -21169,13 +21169,13 @@ var ProtocolData;
21169
21169
  })(ProtocolData.order_type || (ProtocolData.order_type = {}));
21170
21170
  })(ProtocolData || (ProtocolData = {}));
21171
21171
 
21172
- var FeeType;
21172
+ var FeeType$1;
21173
21173
  (function (FeeType) {
21174
21174
  FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
21175
21175
  FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
21176
21176
  FeeType["PROTOCOL"] = "PROTOCOL";
21177
21177
  FeeType["ROYALTY"] = "ROYALTY";
21178
- })(FeeType || (FeeType = {}));
21178
+ })(FeeType$1 || (FeeType$1 = {}));
21179
21179
  var TransactionPurpose;
21180
21180
  (function (TransactionPurpose) {
21181
21181
  TransactionPurpose["APPROVAL"] = "APPROVAL";
@@ -21737,7 +21737,7 @@ class ImmutableApiClient {
21737
21737
  ],
21738
21738
  fees: makerFees.map((x) => ({
21739
21739
  amount: x.amount,
21740
- type: FeeType.MAKER_ECOSYSTEM,
21740
+ type: FeeType$1.MAKER_ECOSYSTEM,
21741
21741
  recipient_address: x.recipientAddress,
21742
21742
  })),
21743
21743
  end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
@@ -21951,7 +21951,7 @@ class Orderbook {
21951
21951
  order_id: listingId,
21952
21952
  fees: takerFees.map((fee) => ({
21953
21953
  amount: fee.amount,
21954
- type: FeeType.TAKER_ECOSYSTEM,
21954
+ type: FeeType$1.TAKER_ECOSYSTEM,
21955
21955
  recipient_address: fee.recipientAddress,
21956
21956
  })),
21957
21957
  },
@@ -21974,7 +21974,7 @@ class Orderbook {
21974
21974
  order_id: listingRequest.listingId,
21975
21975
  fees: listingRequest.takerFees.map((fee) => ({
21976
21976
  amount: fee.amount,
21977
- type: FeeType.TAKER_ECOSYSTEM,
21977
+ type: FeeType$1.TAKER_ECOSYSTEM,
21978
21978
  recipient_address: fee.recipientAddress,
21979
21979
  })),
21980
21980
  })));
@@ -26051,7 +26051,7 @@ class APIError extends Error {
26051
26051
 
26052
26052
  /* eslint-disable implicit-arrow-linebreak */
26053
26053
  const defaultHeaders = {
26054
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.5',
26054
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.37.0',
26055
26055
  };
26056
26056
  /**
26057
26057
  * createAPIConfiguration to create a custom Configuration
@@ -26770,6 +26770,21 @@ var RoutingOutcomeType;
26770
26770
  RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
26771
26771
  RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
26772
26772
  })(RoutingOutcomeType || (RoutingOutcomeType = {}));
26773
+ /**
26774
+ * An enum representing the funding step types
26775
+ * @enum {string}
26776
+ * @property {string} GAS - If the fee is a gas fee.
26777
+ * @property {string} BRIDGE_FEE - If the fee is a bridge fee.
26778
+ * @property {string} SWAP_FEE - If the fee is a swap fee.
26779
+ * @property {string} IMMUTABLE_FEE - If the fee is an immutable fee.
26780
+ */
26781
+ var FeeType;
26782
+ (function (FeeType) {
26783
+ FeeType["GAS"] = "GAS";
26784
+ FeeType["BRIDGE_FEE"] = "BRIDGE_FEE";
26785
+ FeeType["SWAP_FEE"] = "SWAP_FEE";
26786
+ FeeType["IMMUTABLE_FEE"] = "IMMUTABLE_FEE";
26787
+ })(FeeType || (FeeType = {}));
26773
26788
  /**
26774
26789
  * An enum representing the funding step types
26775
26790
  * @enum {string}
@@ -27375,7 +27390,7 @@ const GAS_OVERRIDES = {
27375
27390
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
27376
27391
  };
27377
27392
 
27378
- const SDK_VERSION_MARKER = '0.36.5';
27393
+ const SDK_VERSION_MARKER = '0.37.0';
27379
27394
  // This SDK version is replaced by the `yarn build` command ran on the root level
27380
27395
  const globalPackageVersion = () => SDK_VERSION_MARKER;
27381
27396
 
@@ -28269,8 +28284,8 @@ const erc20ItemAggregator = (itemRequirements) => {
28269
28284
  aggregatedItemRequirements.push(itemRequirement);
28270
28285
  return;
28271
28286
  }
28272
- const { contractAddress, spenderAddress, amount } = itemRequirement;
28273
- const key = `${contractAddress}${spenderAddress}`;
28287
+ const { tokenAddress, spenderAddress, amount } = itemRequirement;
28288
+ const key = `${tokenAddress}${spenderAddress}`;
28274
28289
  const aggregateItem = aggregatedMap.get(key);
28275
28290
  if (aggregateItem && aggregateItem.type === ItemType.ERC20) {
28276
28291
  aggregateItem.amount = BigNumber$1.from(aggregateItem.amount).add(amount);
@@ -28336,10 +28351,10 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
28336
28351
  for (const itemRequirement of itemRequirements) {
28337
28352
  if (itemRequirement.type !== ItemType.ERC20)
28338
28353
  continue;
28339
- const { contractAddress, spenderAddress } = itemRequirement;
28340
- const key = `${contractAddress}${spenderAddress}`;
28354
+ const { tokenAddress, spenderAddress } = itemRequirement;
28355
+ const key = `${tokenAddress}${spenderAddress}`;
28341
28356
  erc20s.set(key, itemRequirement);
28342
- allowancePromises.set(key, getERC20Allowance(provider, ownerAddress, contractAddress, spenderAddress));
28357
+ allowancePromises.set(key, getERC20Allowance(provider, ownerAddress, tokenAddress, spenderAddress));
28343
28358
  }
28344
28359
  const allowances = await Promise.all(allowancePromises.values());
28345
28360
  const allowancePromiseIds = Array.from(allowancePromises.keys());
@@ -28358,8 +28373,8 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
28358
28373
  continue;
28359
28374
  }
28360
28375
  sufficient = false; // Set sufficient false on the root of the return object when an ERC20 is insufficient
28361
- const { contractAddress, spenderAddress } = itemRequirement;
28362
- const key = `${contractAddress}${spenderAddress}`;
28376
+ const { tokenAddress, spenderAddress } = itemRequirement;
28377
+ const key = `${tokenAddress}${spenderAddress}`;
28363
28378
  const delta = itemRequirement.amount.sub(allowances[index]);
28364
28379
  // Create maps for both the insufficient ERC20 data and the transaction promises using the same key so the results can be merged
28365
28380
  insufficientERC20s.set(key, {
@@ -28369,7 +28384,7 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
28369
28384
  itemRequirement,
28370
28385
  approvalTransaction: undefined,
28371
28386
  });
28372
- transactionPromises.set(key, getERC20ApprovalTransaction(provider, ownerAddress, contractAddress, spenderAddress, delta));
28387
+ transactionPromises.set(key, getERC20ApprovalTransaction(provider, ownerAddress, tokenAddress, spenderAddress, delta));
28373
28388
  }
28374
28389
  // Resolves the approval transactions and merges them with the insufficient ERC20 data
28375
28390
  const transactions = await Promise.all(transactionPromises.values());
@@ -28554,8 +28569,8 @@ const erc20BalanceAggregator = (itemRequirements) => {
28554
28569
  aggregatedItemRequirements.push(itemRequirement);
28555
28570
  return;
28556
28571
  }
28557
- const { contractAddress, amount } = itemRequirement;
28558
- const key = `${contractAddress}`;
28572
+ const { tokenAddress, amount } = itemRequirement;
28573
+ const key = `${tokenAddress}`;
28559
28574
  const aggregateItem = aggregatedMap.get(key);
28560
28575
  if (aggregateItem && aggregateItem.type === ItemType.ERC20) {
28561
28576
  aggregateItem.amount = BigNumber$1.from(aggregateItem.amount).add(amount);
@@ -28588,14 +28603,21 @@ const balanceAggregator = (itemRequirements) => erc721BalanceAggregator(erc20Bal
28588
28603
  /* eslint-disable arrow-body-style */
28589
28604
  const getTokensFromRequirements = (itemRequirements) => itemRequirements
28590
28605
  .map((itemRequirement) => {
28591
- if (itemRequirement.type === ItemType.NATIVE) {
28592
- return {
28593
- address: NATIVE,
28594
- };
28606
+ switch (itemRequirement.type) {
28607
+ case ItemType.ERC20:
28608
+ return {
28609
+ address: itemRequirement.tokenAddress,
28610
+ };
28611
+ case ItemType.NATIVE:
28612
+ return {
28613
+ address: NATIVE,
28614
+ };
28615
+ case ItemType.ERC721:
28616
+ default:
28617
+ return {
28618
+ address: itemRequirement.contractAddress,
28619
+ };
28595
28620
  }
28596
- return {
28597
- address: itemRequirement.contractAddress,
28598
- };
28599
28621
  });
28600
28622
  /**
28601
28623
  * Gets the balance requirement with delta for an ERC721 requirement.
@@ -28645,7 +28667,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
28645
28667
  // Get the requirements related balance
28646
28668
  if (itemRequirement.type === ItemType.ERC20) {
28647
28669
  itemBalanceResult = balances.find((balance) => {
28648
- return balance.token?.address === itemRequirement.contractAddress;
28670
+ return balance.token?.address === itemRequirement.tokenAddress;
28649
28671
  });
28650
28672
  }
28651
28673
  else if (itemRequirement.type === ItemType.NATIVE) {
@@ -28709,7 +28731,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
28709
28731
  token: {
28710
28732
  name,
28711
28733
  symbol,
28712
- address: itemRequirement.contractAddress,
28734
+ address: itemRequirement.tokenAddress,
28713
28735
  decimals,
28714
28736
  },
28715
28737
  };
@@ -28868,7 +28890,7 @@ const getGasItemRequirement = (gas, transactionOrGas) => {
28868
28890
  return {
28869
28891
  type: ItemType.ERC20,
28870
28892
  amount: gas,
28871
- contractAddress: transactionOrGas.gasToken.contractAddress,
28893
+ tokenAddress: transactionOrGas.gasToken.tokenAddress,
28872
28894
  spenderAddress: '',
28873
28895
  };
28874
28896
  };
@@ -29091,36 +29113,37 @@ const quoteFetcher = async (config, chainId, walletAddress, requiredToken, swapp
29091
29113
  }
29092
29114
  };
29093
29115
 
29094
- const constructFees$1 = (approvalGasFees, swapGasFees, swapFees) => {
29116
+ const constructFees$1 = (approvalGasFee, swapGasFee, swapFees) => {
29095
29117
  let approvalGasFeeAmount = BigNumber$1.from(0);
29096
29118
  let approvalGasFeeFormatted = '0';
29097
29119
  let approvalToken;
29098
- if (approvalGasFees) {
29099
- approvalGasFeeAmount = approvalGasFees.value;
29100
- approvalGasFeeFormatted = utils$1.formatUnits(approvalGasFees.value, approvalGasFees.token.decimals);
29120
+ if (approvalGasFee) {
29121
+ approvalGasFeeAmount = approvalGasFee.value;
29122
+ approvalGasFeeFormatted = utils$1.formatUnits(approvalGasFee.value, approvalGasFee.token.decimals);
29101
29123
  approvalToken = {
29102
- name: approvalGasFees.token.name ?? '',
29103
- symbol: approvalGasFees.token.symbol ?? '',
29104
- address: approvalGasFees.token.address,
29105
- decimals: approvalGasFees.token.decimals,
29124
+ name: approvalGasFee.token.name ?? '',
29125
+ symbol: approvalGasFee.token.symbol ?? '',
29126
+ address: approvalGasFee.token.address,
29127
+ decimals: approvalGasFee.token.decimals,
29106
29128
  };
29107
29129
  }
29108
29130
  let swapGasFeeAmount = BigNumber$1.from(0);
29109
29131
  let swapGasFeeFormatted = '0';
29110
29132
  let swapGasToken;
29111
- if (swapGasFees) {
29112
- swapGasFeeAmount = swapGasFees.value;
29113
- swapGasFeeFormatted = utils$1.formatUnits(swapGasFees.value, swapGasFees.token.decimals);
29133
+ if (swapGasFee) {
29134
+ swapGasFeeAmount = swapGasFee.value;
29135
+ swapGasFeeFormatted = utils$1.formatUnits(swapGasFee.value, swapGasFee.token.decimals);
29114
29136
  swapGasToken = {
29115
- name: swapGasFees.token.name ?? '',
29116
- symbol: swapGasFees.token.symbol ?? '',
29117
- address: swapGasFees.token.address,
29118
- decimals: swapGasFees.token.decimals,
29137
+ name: swapGasFee.token.name ?? '',
29138
+ symbol: swapGasFee.token.symbol ?? '',
29139
+ address: swapGasFee.token.address,
29140
+ decimals: swapGasFee.token.decimals,
29119
29141
  };
29120
29142
  }
29121
29143
  const fees = [];
29122
29144
  for (const swapFee of swapFees) {
29123
29145
  fees.push({
29146
+ type: FeeType.SWAP_FEE,
29124
29147
  amount: swapFee.amount.value,
29125
29148
  formattedAmount: utils$1.formatUnits(swapFee.amount.value, swapFee.amount.token.decimals),
29126
29149
  token: {
@@ -29132,12 +29155,14 @@ const constructFees$1 = (approvalGasFees, swapGasFees, swapFees) => {
29132
29155
  });
29133
29156
  }
29134
29157
  return {
29135
- approvalGasFees: {
29158
+ approvalGasFee: {
29159
+ type: FeeType.GAS,
29136
29160
  amount: approvalGasFeeAmount,
29137
29161
  formattedAmount: approvalGasFeeFormatted,
29138
29162
  token: approvalToken,
29139
29163
  },
29140
- swapGasFees: {
29164
+ swapGasFee: {
29165
+ type: FeeType.GAS,
29141
29166
  amount: swapGasFeeAmount,
29142
29167
  formattedAmount: swapGasFeeFormatted,
29143
29168
  token: swapGasToken,
@@ -29222,7 +29247,7 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
29222
29247
  // The user has enough to cover approval gas fees
29223
29248
  return { sufficient: true, approvalGasFee, approvalGasTokenAddress };
29224
29249
  };
29225
- const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFees, tokenBeingSwapped) => {
29250
+ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFee, swapFees, tokenBeingSwapped) => {
29226
29251
  // Set up a map of token addresses to amounts for each of the swap fees
29227
29252
  const feeMap = new Map();
29228
29253
  // Add the approval fee to list of fees
@@ -29230,13 +29255,13 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
29230
29255
  feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
29231
29256
  }
29232
29257
  // Add the swap gas fee to list of fees
29233
- if (swapGasFees) {
29234
- const fee = feeMap.get(swapGasFees.token.address);
29258
+ if (swapGasFee) {
29259
+ const fee = feeMap.get(swapGasFee.token.address);
29235
29260
  if (fee) {
29236
- feeMap.set(swapGasFees.token.address, fee.add(swapGasFees.value));
29261
+ feeMap.set(swapGasFee.token.address, fee.add(swapGasFee.value));
29237
29262
  }
29238
29263
  else {
29239
- feeMap.set(swapGasFees.token.address, swapGasFees.value);
29264
+ feeMap.set(swapGasFee.token.address, swapGasFee.value);
29240
29265
  }
29241
29266
  }
29242
29267
  // Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
@@ -29490,31 +29515,39 @@ const hasSufficientL1Eth = (tokenBalanceResult, totalFees) => {
29490
29515
  const balance = getEthBalance(tokenBalanceResult);
29491
29516
  return balance.gte(totalFees);
29492
29517
  };
29493
- const constructFees = (bridgeGasFees, bridgeFee, imtblFee, approvalGasFees, token) => {
29518
+ const constructFees = (bridgeGasFee, bridgeFee, imtblFee, approvalGasFee, token) => {
29494
29519
  const bridgeFeeDecimals = token?.decimals ?? DEFAULT_TOKEN_DECIMALS$1;
29520
+ const bridgeFees = [];
29521
+ if (bridgeFee.gt(0)) {
29522
+ bridgeFees.push({
29523
+ type: FeeType.BRIDGE_FEE,
29524
+ amount: bridgeFee,
29525
+ formattedAmount: utils$1.formatUnits(bridgeFee, bridgeFeeDecimals),
29526
+ token,
29527
+ });
29528
+ }
29529
+ if (imtblFee.gt(0)) {
29530
+ bridgeFees.push({
29531
+ type: FeeType.IMMUTABLE_FEE,
29532
+ amount: imtblFee,
29533
+ formattedAmount: utils$1.formatUnits(imtblFee, bridgeFeeDecimals),
29534
+ token,
29535
+ });
29536
+ }
29495
29537
  return {
29496
- approvalGasFees: {
29497
- amount: approvalGasFees,
29498
- formattedAmount: utils$1.formatUnits(approvalGasFees, DEFAULT_TOKEN_DECIMALS$1),
29538
+ approvalGasFee: {
29539
+ type: FeeType.GAS,
29540
+ amount: approvalGasFee,
29541
+ formattedAmount: utils$1.formatUnits(approvalGasFee, DEFAULT_TOKEN_DECIMALS$1),
29499
29542
  token,
29500
29543
  },
29501
- bridgeGasFees: {
29502
- amount: bridgeGasFees,
29503
- formattedAmount: utils$1.formatUnits(bridgeGasFees, DEFAULT_TOKEN_DECIMALS$1),
29544
+ bridgeGasFee: {
29545
+ type: FeeType.GAS,
29546
+ amount: bridgeGasFee,
29547
+ formattedAmount: utils$1.formatUnits(bridgeGasFee, DEFAULT_TOKEN_DECIMALS$1),
29504
29548
  token,
29505
29549
  },
29506
- bridgeFees: [
29507
- {
29508
- amount: bridgeFee,
29509
- formattedAmount: utils$1.formatUnits(bridgeFee, bridgeFeeDecimals),
29510
- token,
29511
- },
29512
- {
29513
- amount: imtblFee,
29514
- formattedAmount: utils$1.formatUnits(imtblFee, bridgeFeeDecimals),
29515
- token,
29516
- },
29517
- ],
29550
+ bridgeFees,
29518
29551
  };
29519
29552
  };
29520
29553
  const constructBridgeFundingRoute = (chainId, balance, bridgeRequirement, itemType, fees) => ({
@@ -30373,13 +30406,13 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
30373
30406
  return calculateFeesResult;
30374
30407
  };
30375
30408
 
30376
- const getItemRequirement = (type, contractAddress, amount, spenderAddress) => {
30409
+ const getItemRequirement = (type, tokenAddress, amount, spenderAddress) => {
30377
30410
  switch (type) {
30378
30411
  case ItemType.ERC20:
30379
30412
  return {
30380
30413
  type,
30381
30414
  amount,
30382
- contractAddress,
30415
+ tokenAddress,
30383
30416
  spenderAddress,
30384
30417
  };
30385
30418
  case ItemType.NATIVE:
@@ -30602,7 +30635,7 @@ const getBuyToken = (buyToken, decimals = 18) => {
30602
30635
  return {
30603
30636
  type: ItemType.ERC20,
30604
30637
  amount: bnAmount.toString(),
30605
- contractAddress: buyToken.contractAddress,
30638
+ contractAddress: buyToken.tokenAddress,
30606
30639
  };
30607
30640
  };
30608
30641
  const sell = async (config, provider, orders) => {
@@ -30616,7 +30649,7 @@ const sell = async (config, provider, orders) => {
30616
30649
  let decimals = 18;
30617
30650
  if (buyToken.type === ItemType.ERC20) {
30618
30651
  // get this from the allowed list
30619
- const buyTokenContract = new Contract$1(buyToken.contractAddress, JSON.stringify(ERC20ABI), provider);
30652
+ const buyTokenContract = new Contract$1(buyToken.tokenAddress, JSON.stringify(ERC20ABI), provider);
30620
30653
  decimals = await measureAsyncExecution(config, 'Time to get decimals of token contract for the buy token', buyTokenContract.decimals());
30621
30654
  }
30622
30655
  const buyTokenOrNative = getBuyToken(buyToken, decimals);
@@ -30768,8 +30801,8 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
30768
30801
  const decimalPromises = [];
30769
30802
  requirements.forEach((itemRequirementParam) => {
30770
30803
  if (itemRequirementParam.type === ItemType.ERC20) {
30771
- const { contractAddress } = itemRequirementParam;
30772
- decimalPromises.push(getTokenContract(contractAddress, ERC20ABI, provider).decimals());
30804
+ const { tokenAddress } = itemRequirementParam;
30805
+ decimalPromises.push(getTokenContract(tokenAddress, ERC20ABI, provider).decimals());
30773
30806
  }
30774
30807
  });
30775
30808
  const decimals = await Promise.all(decimalPromises);
@@ -31084,7 +31117,7 @@ class Checkout {
31084
31117
  try {
31085
31118
  itemRequirements = await getItemRequirementsFromRequirements(web3Provider, params.itemRequirements);
31086
31119
  }
31087
- catch {
31120
+ catch (error) {
31088
31121
  throw new CheckoutError('Failed to map item requirements', CheckoutErrorType.ITEM_REQUIREMENTS_ERROR);
31089
31122
  }
31090
31123
  return await smartCheckout(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
@@ -31152,4 +31185,4 @@ class Checkout {
31152
31185
  }
31153
31186
  }
31154
31187
 
31155
- export { BridgeEventType, ChainId, ChainName, ChainSlug, Checkout, CheckoutConfiguration, CheckoutErrorType, CheckoutStatus, ConnectEventType, ConnectTargetLayer, ExchangeType, FundingStepType, GasEstimateType, GasTokenType, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, ItemType, NetworkFilterTypes, OnRampEventType, OrchestrationEventType, ProviderEventType, RoutingOutcomeType, SaleEventType, SwapEventType, TokenFilterTypes, TransactionOrGasType, WalletEventType, WalletFilterTypes, WalletProviderName, WidgetTheme, WidgetType };
31188
+ export { BridgeEventType, ChainId, ChainName, ChainSlug, Checkout, CheckoutConfiguration, CheckoutErrorType, CheckoutStatus, ConnectEventType, ConnectTargetLayer, ExchangeType, FeeType, FundingStepType, GasEstimateType, GasTokenType, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, ItemType, NetworkFilterTypes, OnRampEventType, OrchestrationEventType, ProviderEventType, RoutingOutcomeType, SaleEventType, SwapEventType, TokenFilterTypes, TransactionOrGasType, WalletEventType, WalletFilterTypes, WalletProviderName, WidgetTheme, WidgetType };
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
17
17
  chainID,
18
18
  coreContractAddress,
19
19
  registrationContractAddress,
20
- sdkVersion: 'ts-immutable-sdk-0.36.5',
20
+ sdkVersion: 'ts-immutable-sdk-0.37.0',
21
21
  });
22
22
  /**
23
23
  * Sets `sdkVersion` at the time of build