@imtbl/sdk 0.36.1-alpha.1 → 0.36.2-alpha.1

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.
@@ -10680,12 +10680,12 @@ interface TokenInfo {
10680
10680
  * Interface representing the parameters for {@link Checkout.getBalance}.
10681
10681
  * @property {Web3Provider} provider - The provider used to get the balance.
10682
10682
  * @property {string} walletAddress - The wallet address.
10683
- * @property {string | undefined} contractAddress - The contract address of the token.
10683
+ * @property {string | undefined} tokenAddress - The contract address of the token.
10684
10684
  */
10685
10685
  interface GetBalanceParams {
10686
10686
  provider: Web3Provider;
10687
10687
  walletAddress: string;
10688
- contractAddress?: string;
10688
+ tokenAddress?: string;
10689
10689
  }
10690
10690
  /**
10691
10691
  * Interface representing the result of {@link Checkout.getBalance}.
@@ -10700,13 +10700,13 @@ interface GetBalanceResult {
10700
10700
  }
10701
10701
  /**
10702
10702
  * Interface representing the parameters for {@link Checkout.getAllBalances}.
10703
- * @property {Web3Provider} provider - The provider used to get the balances.
10704
- * @property {string} walletAddress - The wallet address.
10703
+ * @property {Web3Provider} provider - The provider used to get the balances, it is a required parameter if no walletAddress is provided.
10704
+ * @property {string} walletAddress - The wallet address, it is a required parameter if no provider is provided.
10705
10705
  * @property {ChainId} chainId - The ID of the network.
10706
10706
  */
10707
10707
  interface GetAllBalancesParams {
10708
- provider: Web3Provider;
10709
- walletAddress: string;
10708
+ provider?: Web3Provider;
10709
+ walletAddress?: string;
10710
10710
  chainId: ChainId;
10711
10711
  }
10712
10712
  /**
@@ -12354,13 +12354,13 @@ type ConnectWidgetParams = {};
12354
12354
 
12355
12355
  /**
12356
12356
  * Bridge Widget parameters
12357
- * @property {string | undefined} contractAddress
12357
+ * @property {string | undefined} tokenAddress
12358
12358
  * @property {string | undefined} amount
12359
12359
  * @property {WalletProviderName | undefined} walletProviderName
12360
12360
  */
12361
12361
  type BridgeWidgetParams = {
12362
12362
  /** The contract address of the token to bridge from, used to populate the bridge form token field */
12363
- contractAddress?: string;
12363
+ tokenAddress?: string;
12364
12364
  /** The formatted amount to bridge, used to populate the bridge form amount field */
12365
12365
  amount?: string;
12366
12366
  /** The wallet provider name to use for the bridge widget */
@@ -12379,30 +12379,30 @@ type WalletWidgetParams = {
12379
12379
  /**
12380
12380
  * Swap Widget parameters
12381
12381
  * @property {string | undefined} amount
12382
- * @property {string | undefined} fromContractAddress
12383
- * @property {string | undefined} toContractAddress
12382
+ * @property {string | undefined} fromTokenAddress
12383
+ * @property {string | undefined} toTokenAddress
12384
12384
  * @property {WalletProviderName | undefined} walletProviderName
12385
12385
  */
12386
12386
  type SwapWidgetParams = {
12387
12387
  /** The formatted amount to swap, used to populate the swap from amount field */
12388
12388
  amount?: string;
12389
12389
  /** The contract address of the token to swap from */
12390
- fromContractAddress?: string;
12390
+ fromTokenAddress?: string;
12391
12391
  /** The contract address of the token to swap to */
12392
- toContractAddress?: string;
12392
+ toTokenAddress?: string;
12393
12393
  /** The wallet provider name to use for the swap widget */
12394
12394
  walletProviderName?: WalletProviderName;
12395
12395
  };
12396
12396
 
12397
12397
  /**
12398
12398
  * OnRamp Widget parameters
12399
- * @property {string | undefined} contractAddress
12399
+ * @property {string | undefined} tokenAddress
12400
12400
  * @property {string | undefined} amount
12401
12401
  * @property {WalletProviderName | undefined} walletProviderName
12402
12402
  */
12403
12403
  type OnRampWidgetParams = {
12404
12404
  /** The contract address of the token to onramp */
12405
- contractAddress?: string;
12405
+ tokenAddress?: string;
12406
12406
  /** The formatted amount to onramp, used to populate the onramp form amount field */
12407
12407
  amount?: string;
12408
12408
  /** The wallet provider name to use for the onramp widget */
@@ -12413,7 +12413,7 @@ type OnRampWidgetParams = {
12413
12413
  * Sale Widget parameters
12414
12414
  * @property {string} amount
12415
12415
  * @property {string} environmentId
12416
- * @property {string} fromContractAddress
12416
+ * @property {string} fromTokenAddress
12417
12417
  * @property {SaleItem[]} items
12418
12418
  * @property {WalletProviderName | undefined} walletProviderName
12419
12419
  */
@@ -12421,7 +12421,7 @@ type SaleWidgetParams = {
12421
12421
  /** The total price to pay for the items in the sale */
12422
12422
  amount?: string;
12423
12423
  environmentId?: string;
12424
- fromContractAddress?: string;
12424
+ fromTokenAddress?: string;
12425
12425
  /** The list of products to be purchased */
12426
12426
  items?: SaleItem[];
12427
12427
  /** The wallet provider name to default to if no web3Provider is passed */
@@ -12929,6 +12929,7 @@ declare const IMMUTABLE_API_BASE_URL: {
12929
12929
  * Enum representing different types of errors that can occur during the checkout process.
12930
12930
  */
12931
12931
  declare enum CheckoutErrorType {
12932
+ MISSING_PARAMS = "MISSING_PARAMS",
12932
12933
  WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
12933
12934
  PROVIDER_ERROR = "PROVIDER_ERROR",
12934
12935
  DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
package/dist/checkout.js CHANGED
@@ -12519,59 +12519,18 @@ function parseUnits(value, unitName) {
12519
12519
  return parseFixed(value, (unitName != null) ? unitName : 18);
12520
12520
  }
12521
12521
 
12522
- /**
12523
- * @typedef {Object} CompletionStatus
12524
- * @property {string} SUCCESS - The transaction has been successfully synced.
12525
- * @property {string} PENDING - The transaction is still pending.
12526
- * @property {string} FAILED - The transaction has failed.
12527
- */
12528
- var CompletionStatus;
12529
- (function (CompletionStatus) {
12530
- CompletionStatus["SUCCESS"] = "SUCCESS";
12531
- CompletionStatus["PENDING"] = "PENDING";
12532
- CompletionStatus["FAILED"] = "FAILED";
12533
- })(CompletionStatus || (CompletionStatus = {}));
12534
- /**
12535
- * @typedef {Object} BridgeFeeActions
12536
- * @property {string} DEPOSIT - The transaction has been successfully synced.
12537
- * @property {string} WITHDRAW - The transaction is still pending.
12538
- * @property {string} FINALISE_WITHDRAWAL - Calculate gas .
12539
- */
12540
- var BridgeFeeActions;
12541
- (function (BridgeFeeActions) {
12542
- BridgeFeeActions["DEPOSIT"] = "DEPOSIT";
12543
- BridgeFeeActions["WITHDRAW"] = "WITHDRAW";
12544
- BridgeFeeActions["FINALISE_WITHDRAWAL"] = "FINALISE_WITHDRAWAL";
12545
- })(BridgeFeeActions || (BridgeFeeActions = {}));
12546
- /**
12547
- * @typedef {Object} BridgeMethodGas
12548
- * @property {string} DEPOSIT_SOURCE - The gas required to deposit to the bridge.
12549
- * @property {string} DEPOSIT_DESTINATION - The gas required to process the deposit on the destination chain.
12550
- * @property {string} WITHDRAW_SOURCE - The gas required to withdraw from the bridge.
12551
- * @property {string} WITHDRAW_DESTINATION - The gas required to process the withdrawal on the destination chain.
12552
- * @property {string} FINALISE_WITHDRAWAL - The gas required to finalise a withdrawal from the flow rate queue.
12553
- */
12554
- var BridgeMethodsGasLimit;
12555
- (function (BridgeMethodsGasLimit) {
12556
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 500000] = "DEPOSIT_SOURCE";
12557
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 700000] = "DEPOSIT_DESTINATION";
12558
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 400000] = "WITHDRAW_SOURCE";
12559
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 700000] = "WITHDRAW_DESTINATION";
12560
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 300000] = "MAP_TOKEN_SOURCE";
12561
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 700000] = "MAP_TOKEN_DESTINATION";
12562
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
12563
- })(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
12564
- var StatusResponse;
12565
- (function (StatusResponse) {
12566
- StatusResponse["PROCESSING"] = "PROCESSING";
12567
- StatusResponse["COMPLETE"] = "COMPLETE";
12568
- StatusResponse["RETRY"] = "RETRY";
12569
- StatusResponse["ERROR"] = "ERROR";
12570
- StatusResponse["NOT_ENOUGH_GAS"] = "NOT_ENOUGH_GAS";
12571
- StatusResponse["FLOW_RATE_CONTROLLED"] = "FLOW_RATE_CONTROLLED";
12572
- })(StatusResponse || (StatusResponse = {}));
12573
-
12574
12522
  const ROOT_ERC20_BRIDGE_FLOW_RATE = [
12523
+ {
12524
+ inputs: [
12525
+ {
12526
+ internalType: 'address',
12527
+ name: '_initializerAddress',
12528
+ type: 'address',
12529
+ },
12530
+ ],
12531
+ stateMutability: 'nonpayable',
12532
+ type: 'constructor',
12533
+ },
12575
12534
  {
12576
12535
  inputs: [],
12577
12536
  name: 'AlreadyMapped',
@@ -12722,6 +12681,16 @@ const ROOT_ERC20_BRIDGE_FLOW_RATE = [
12722
12681
  name: 'TokenIsZero',
12723
12682
  type: 'error',
12724
12683
  },
12684
+ {
12685
+ inputs: [],
12686
+ name: 'TokenNotSupported',
12687
+ type: 'error',
12688
+ },
12689
+ {
12690
+ inputs: [],
12691
+ name: 'UnauthorizedInitializer',
12692
+ type: 'error',
12693
+ },
12725
12694
  {
12726
12695
  inputs: [
12727
12696
  {
@@ -14145,6 +14114,19 @@ const ROOT_ERC20_BRIDGE_FLOW_RATE = [
14145
14114
  stateMutability: 'pure',
14146
14115
  type: 'function',
14147
14116
  },
14117
+ {
14118
+ inputs: [],
14119
+ name: 'initializerAddress',
14120
+ outputs: [
14121
+ {
14122
+ internalType: 'address',
14123
+ name: '',
14124
+ type: 'address',
14125
+ },
14126
+ ],
14127
+ stateMutability: 'view',
14128
+ type: 'function',
14129
+ },
14148
14130
  {
14149
14131
  inputs: [
14150
14132
  {
@@ -14841,6 +14823,17 @@ const withBridgeError = async (fn, customErrorType, details) => {
14841
14823
  };
14842
14824
 
14843
14825
  const CHILD_ERC20_BRIDGE = [
14826
+ {
14827
+ inputs: [
14828
+ {
14829
+ internalType: 'address',
14830
+ name: '_initializerAddress',
14831
+ type: 'address',
14832
+ },
14833
+ ],
14834
+ stateMutability: 'nonpayable',
14835
+ type: 'constructor',
14836
+ },
14844
14837
  {
14845
14838
  inputs: [],
14846
14839
  name: 'AlreadyMapped',
@@ -14943,6 +14936,11 @@ const CHILD_ERC20_BRIDGE = [
14943
14936
  name: 'TransferWIMXFailed',
14944
14937
  type: 'error',
14945
14938
  },
14939
+ {
14940
+ inputs: [],
14941
+ name: 'UnauthorizedInitializer',
14942
+ type: 'error',
14943
+ },
14946
14944
  {
14947
14945
  inputs: [],
14948
14946
  name: 'ZeroAddress',
@@ -15697,6 +15695,19 @@ const CHILD_ERC20_BRIDGE = [
15697
15695
  stateMutability: 'nonpayable',
15698
15696
  type: 'function',
15699
15697
  },
15698
+ {
15699
+ inputs: [],
15700
+ name: 'initializerAddress',
15701
+ outputs: [
15702
+ {
15703
+ internalType: 'address',
15704
+ name: '',
15705
+ type: 'address',
15706
+ },
15707
+ ],
15708
+ stateMutability: 'view',
15709
+ type: 'function',
15710
+ },
15700
15711
  {
15701
15712
  inputs: [
15702
15713
  {
@@ -16046,6 +16057,58 @@ const getGasPriceInWei$1 = (feeData) => {
16046
16057
  return null;
16047
16058
  };
16048
16059
 
16060
+ /**
16061
+ * @typedef {Object} CompletionStatus
16062
+ * @property {string} SUCCESS - The transaction has been successfully synced.
16063
+ * @property {string} PENDING - The transaction is still pending.
16064
+ * @property {string} FAILED - The transaction has failed.
16065
+ */
16066
+ var CompletionStatus;
16067
+ (function (CompletionStatus) {
16068
+ CompletionStatus["SUCCESS"] = "SUCCESS";
16069
+ CompletionStatus["PENDING"] = "PENDING";
16070
+ CompletionStatus["FAILED"] = "FAILED";
16071
+ })(CompletionStatus || (CompletionStatus = {}));
16072
+ /**
16073
+ * @typedef {Object} BridgeFeeActions
16074
+ * @property {string} DEPOSIT - The transaction has been successfully synced.
16075
+ * @property {string} WITHDRAW - The transaction is still pending.
16076
+ * @property {string} FINALISE_WITHDRAWAL - Calculate gas .
16077
+ */
16078
+ var BridgeFeeActions;
16079
+ (function (BridgeFeeActions) {
16080
+ BridgeFeeActions["DEPOSIT"] = "DEPOSIT";
16081
+ BridgeFeeActions["WITHDRAW"] = "WITHDRAW";
16082
+ BridgeFeeActions["FINALISE_WITHDRAWAL"] = "FINALISE_WITHDRAWAL";
16083
+ })(BridgeFeeActions || (BridgeFeeActions = {}));
16084
+ /**
16085
+ * @typedef {Object} BridgeMethodGas
16086
+ * @property {string} DEPOSIT_SOURCE - The gas required to deposit to the bridge.
16087
+ * @property {string} DEPOSIT_DESTINATION - The gas required to process the deposit on the destination chain.
16088
+ * @property {string} WITHDRAW_SOURCE - The gas required to withdraw from the bridge.
16089
+ * @property {string} WITHDRAW_DESTINATION - The gas required to process the withdrawal on the destination chain.
16090
+ * @property {string} FINALISE_WITHDRAWAL - The gas required to finalise a withdrawal from the flow rate queue.
16091
+ */
16092
+ var BridgeMethodsGasLimit;
16093
+ (function (BridgeMethodsGasLimit) {
16094
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 500000] = "DEPOSIT_SOURCE";
16095
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 700000] = "DEPOSIT_DESTINATION";
16096
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 400000] = "WITHDRAW_SOURCE";
16097
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 700000] = "WITHDRAW_DESTINATION";
16098
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 300000] = "MAP_TOKEN_SOURCE";
16099
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 700000] = "MAP_TOKEN_DESTINATION";
16100
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
16101
+ })(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
16102
+ var StatusResponse;
16103
+ (function (StatusResponse) {
16104
+ StatusResponse["PROCESSING"] = "PROCESSING";
16105
+ StatusResponse["COMPLETE"] = "COMPLETE";
16106
+ StatusResponse["RETRY"] = "RETRY";
16107
+ StatusResponse["ERROR"] = "ERROR";
16108
+ StatusResponse["NOT_ENOUGH_GAS"] = "NOT_ENOUGH_GAS";
16109
+ StatusResponse["FLOW_RATE_CONTROLLED"] = "FLOW_RATE_CONTROLLED";
16110
+ })(StatusResponse || (StatusResponse = {}));
16111
+
16049
16112
  /* eslint-disable class-methods-use-this */
16050
16113
  /**
16051
16114
  * Represents a token bridge, which manages asset transfers between two chains.
@@ -16666,8 +16729,8 @@ const CONTRACTS_FOR_BRIDGE = new Map()
16666
16729
  wrappedIMX: '0x0',
16667
16730
  })
16668
16731
  .set(ETH_SEPOLIA_TO_ZKEVM_TESTNET, {
16669
- rootERC20BridgeFlowRate: '0x8d4528775a4406Def316DC2b450eE539750F8FAA',
16670
- childERC20Bridge: '0xb0f971e2d11A4D410148af51b170D64E725c0bB9',
16732
+ rootERC20BridgeFlowRate: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
16733
+ childERC20Bridge: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
16671
16734
  wrappedIMX: '0xa86C6C6d3D51c0592BE85dA05A9b06B62360D56E',
16672
16735
  })
16673
16736
  .set(ETH_MAINNET_TO_ZKEVM_MAINNET, {
@@ -25770,7 +25833,7 @@ class APIError extends Error {
25770
25833
 
25771
25834
  /* eslint-disable implicit-arrow-linebreak */
25772
25835
  const defaultHeaders = {
25773
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.1-alpha.1',
25836
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.2-alpha.1',
25774
25837
  };
25775
25838
  /**
25776
25839
  * createAPIConfiguration to create a custom Configuration
@@ -26502,6 +26565,7 @@ var ExchangeType;
26502
26565
  */
26503
26566
  var CheckoutErrorType;
26504
26567
  (function (CheckoutErrorType) {
26568
+ CheckoutErrorType["MISSING_PARAMS"] = "MISSING_PARAMS";
26505
26569
  CheckoutErrorType["WEB3_PROVIDER_ERROR"] = "WEB3_PROVIDER_ERROR";
26506
26570
  CheckoutErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
26507
26571
  CheckoutErrorType["DEFAULT_PROVIDER_ERROR"] = "DEFAULT_PROVIDER_ERROR";
@@ -26863,7 +26927,7 @@ const BLOCKSCOUT_CHAIN_URL_MAP = {
26863
26927
  nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
26864
26928
  },
26865
26929
  [ChainId.IMTBL_ZKEVM_MAINNET]: {
26866
- url: 'https://explorer.mainnet.immutable.com',
26930
+ url: 'https://explorer.immutable.com',
26867
26931
  nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
26868
26932
  },
26869
26933
  [ChainId.SEPOLIA]: {
@@ -27075,7 +27139,7 @@ const GAS_OVERRIDES = {
27075
27139
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
27076
27140
  };
27077
27141
 
27078
- const SDK_VERSION_MARKER = '0.36.1-alpha.1';
27142
+ const SDK_VERSION_MARKER = '0.36.2-alpha.1';
27079
27143
  // This SDK version is replaced by the `yarn build` command ran on the root level
27080
27144
  const globalPackageVersion = () => SDK_VERSION_MARKER;
27081
27145
 
@@ -27402,9 +27466,9 @@ const getBalance = async (config, web3Provider, walletAddress) => await withChec
27402
27466
  token: networkInfo.nativeCurrency,
27403
27467
  };
27404
27468
  }, { type: CheckoutErrorType.GET_BALANCE_ERROR });
27405
- async function getERC20Balance(web3Provider, walletAddress, contractAddress) {
27469
+ async function getERC20Balance(web3Provider, walletAddress, tokenAddress) {
27406
27470
  return await withCheckoutError(async () => {
27407
- const contract = new Contract$1(contractAddress, JSON.stringify(ERC20ABI), web3Provider);
27471
+ const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
27408
27472
  return Promise.all([
27409
27473
  contract.name(),
27410
27474
  contract.symbol(),
@@ -27420,7 +27484,7 @@ async function getERC20Balance(web3Provider, walletAddress, contractAddress) {
27420
27484
  name,
27421
27485
  symbol,
27422
27486
  decimals,
27423
- address: contractAddress,
27487
+ address: tokenAddress,
27424
27488
  },
27425
27489
  };
27426
27490
  });
@@ -27531,8 +27595,9 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
27531
27595
  return { balances };
27532
27596
  };
27533
27597
  const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
27534
- // eslint-disable-next-line no-param-reassign
27535
- chainId ||= await web3Provider.getSigner().getChainId();
27598
+ if (!walletAddress && !web3Provider) {
27599
+ throw new CheckoutError('both walletAddress and provider are missing. At least one must be provided.', CheckoutErrorType.MISSING_PARAMS);
27600
+ }
27536
27601
  const { tokens } = await getTokenAllowList(config, {
27537
27602
  type: TokenFilterTypes.ALL,
27538
27603
  chainId,
@@ -27548,6 +27613,7 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
27548
27613
  // eslint-disable-next-line no-console
27549
27614
  console.error(err);
27550
27615
  }
27616
+ let address = walletAddress;
27551
27617
  if (flag && Blockscout.isChainSupported(chainId)) {
27552
27618
  // This is a hack because the widgets are still using the tokens symbol
27553
27619
  // to drive the conversions. If we remove all the token symbols from e.g. zkevm
@@ -27555,12 +27621,18 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
27555
27621
  // Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
27556
27622
  // is done.
27557
27623
  const isL1Chain = getL1ChainId(config) === chainId;
27558
- return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(walletAddress, chainId, isL1Chain ? tokens : undefined));
27624
+ if (!address)
27625
+ address = await web3Provider?.getSigner().getAddress();
27626
+ return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(address, chainId, isL1Chain ? tokens : undefined));
27627
+ }
27628
+ if (!web3Provider) {
27629
+ throw new CheckoutError('indexer is disabled for this chain, you must provide a provider.', CheckoutErrorType.MISSING_PARAMS);
27559
27630
  }
27560
27631
  // This fallback to use ERC20s calls which is a best effort solution
27561
27632
  // Fails in fetching data from the RCP calls might result in some
27562
27633
  // missing data.
27563
- return await measureAsyncExecution(config, `Time to fetch balances using RPC for ${chainId}`, getBalances(config, web3Provider, walletAddress, tokens));
27634
+ address ||= await web3Provider.getSigner().getAddress();
27635
+ return await measureAsyncExecution(config, `Time to fetch balances using RPC for ${chainId}`, getBalances(config, web3Provider, address, tokens));
27564
27636
  };
27565
27637
 
27566
27638
  async function checkIsWalletConnected(web3Provider) {
@@ -29087,14 +29159,16 @@ const getEthBalance = (balances) => {
29087
29159
  const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toChainId) => {
29088
29160
  const bridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
29089
29161
  try {
29090
- const fee = await bridge.getFee({
29162
+ const bridgeFeeResponse = await bridge.getFee({
29091
29163
  action: BridgeFeeActions.DEPOSIT,
29092
29164
  gasMultiplier: 1.1,
29093
29165
  sourceChainId: fromChainId.toString(),
29094
29166
  destinationChainId: toChainId.toString(),
29095
29167
  });
29096
- fee.approvalGas = BigNumber$1.from(0);
29097
- return fee;
29168
+ return {
29169
+ ...bridgeFeeResponse,
29170
+ approvalGas: BigNumber$1.from(0),
29171
+ };
29098
29172
  }
29099
29173
  catch (err) {
29100
29174
  throw new CheckoutError('Error estimating gas for bridge', CheckoutErrorType.BRIDGE_GAS_ESTIMATE_ERROR, { message: err.message });
@@ -30632,10 +30706,10 @@ class Checkout {
30632
30706
  */
30633
30707
  async getBalance(params) {
30634
30708
  const web3Provider = await validateProvider(this.config, params.provider);
30635
- if (!params.contractAddress || params.contractAddress === '') {
30709
+ if (!params.tokenAddress || params.tokenAddress === '') {
30636
30710
  return await getBalance(this.config, web3Provider, params.walletAddress);
30637
30711
  }
30638
- return await getERC20Balance(web3Provider, params.walletAddress, params.contractAddress);
30712
+ return await getERC20Balance(web3Provider, params.walletAddress, params.tokenAddress);
30639
30713
  }
30640
30714
  /**
30641
30715
  * Retrieves the balances of all tokens for a given wallet address on a specific chain.
@@ -30643,8 +30717,7 @@ class Checkout {
30643
30717
  * @returns {Promise<GetAllBalancesResult>} - A promise that resolves to the result of retrieving the balances.
30644
30718
  */
30645
30719
  async getAllBalances(params) {
30646
- const web3Provider = await validateProvider(this.config, params.provider);
30647
- return getAllBalances(this.config, web3Provider, params.walletAddress, params.chainId);
30720
+ return getAllBalances(this.config, params.provider, params.walletAddress, params.chainId);
30648
30721
  }
30649
30722
  /**
30650
30723
  * Retrieves the supported networks based on the provided parameters.
@@ -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.1-alpha.1',
20
+ sdkVersion: 'ts-immutable-sdk-0.36.2-alpha.1',
21
21
  });
22
22
  /**
23
23
  * Sets `sdkVersion` at the time of build