@imtbl/sdk 1.1.0 → 1.1.2

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
@@ -57,6 +57,7 @@ var Detail$1;
57
57
  Detail["PUBLISHABLE_API_KEY"] = "pak";
58
58
  Detail["IDENTITY"] = "uid";
59
59
  Detail["DOMAIN"] = "domain";
60
+ Detail["SDK_VERSION"] = "sdkVersion";
60
61
  })(Detail$1 || (Detail$1 = {}));
61
62
  var Store$1;
62
63
  (function (Store) {
@@ -150,7 +151,7 @@ const getDetail$1 = (key) => {
150
151
  const getAllDetails$1 = () => RUNTIME_DETAILS$1;
151
152
  // Events
152
153
  const getEvents$1 = () => EVENT_STORE$1;
153
- const addEvent$1 = (event) => {
154
+ const addEvent = (event) => {
154
155
  EVENT_STORE$1.push(event);
155
156
  setItem$1(Store$1.EVENTS, EVENT_STORE$1);
156
157
  };
@@ -171,6 +172,8 @@ const flattenProperties$1 = (properties) => {
171
172
  return propertyMap;
172
173
  };
173
174
 
175
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
176
+ const SDK_VERSION$1 = '1.1.2';
174
177
  let initialised$1 = false;
175
178
  const isInitialised$1 = () => initialised$1;
176
179
  const getReferrer$1 = () => {
@@ -193,14 +196,16 @@ const runtimeHost$1 = () => {
193
196
  return new URL(window.location.href).hostname;
194
197
  };
195
198
  const getRuntimeDetails$1 = () => {
199
+ storeDetail$1(Detail$1.SDK_VERSION, SDK_VERSION$1);
196
200
  if (isNode$1()) {
197
- return { browser: 'nodejs' };
201
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION$1 };
198
202
  }
199
203
  const domain = runtimeHost$1();
200
204
  if (domain) {
201
205
  storeDetail$1(Detail$1.DOMAIN, domain);
202
206
  }
203
207
  return {
208
+ sdkVersion: SDK_VERSION$1,
204
209
  browser: window.navigator.userAgent,
205
210
  domain,
206
211
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -209,7 +214,6 @@ const getRuntimeDetails$1 = () => {
209
214
  };
210
215
  const initialise$2 = async () => {
211
216
  const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
212
- // Get any existing runtimeId and send it along with the initialise
213
217
  const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
214
218
  const body = {
215
219
  version: 1,
@@ -249,19 +253,21 @@ function isTestEnvironment$1() {
249
253
  if (typeof process === 'undefined') {
250
254
  return false;
251
255
  }
256
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
257
+ // Just use process.env.CI for now.
252
258
  return process.env.JEST_WORKER_ID !== undefined;
253
259
  }
254
260
 
255
261
  // Store the event in the event store
256
- const trackFn$1 = (moduleName, eventName, properties) => {
262
+ const trackFn = (moduleName, eventName, properties) => {
257
263
  const event = {
258
264
  event: `${moduleName}.${eventName}`,
259
265
  time: new Date().toISOString(),
260
266
  ...(properties && { properties: flattenProperties$1(properties) }),
261
267
  };
262
- addEvent$1(event);
268
+ addEvent(event);
263
269
  };
264
- const track$1 = errorBoundary$1(trackFn$1);
270
+ const track = errorBoundary$1(trackFn);
265
271
  // Sending events to the server
266
272
  const flushFn$1 = async () => {
267
273
  // Don't flush if not initialised
@@ -319,7 +325,7 @@ const identifyFn = (params) => {
319
325
  return;
320
326
  }
321
327
  storeDetail$1(Detail$1.IDENTITY, identity);
322
- track$1('metrics', 'identify', params.traits);
328
+ track('metrics', 'identify', params.traits);
323
329
  };
324
330
  const identify = errorBoundary$1(identifyFn);
325
331
 
@@ -336,10 +342,6 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
336
342
  };
337
343
  const setPublishableApiKey = errorBoundary$1(setPublishableApiKeyFn);
338
344
 
339
- track$1('metrics', 'sdk_version', {
340
- version: '1.1.0',
341
- });
342
-
343
345
  var Environment$1;
344
346
  (function (Environment) {
345
347
  Environment["PRODUCTION"] = "production";
@@ -353,7 +355,7 @@ class ImmutableConfiguration {
353
355
  constructor(options) {
354
356
  this.environment = options.environment;
355
357
  setEnvironment(options.environment);
356
- track$1('config', 'created_imtbl_config');
358
+ track('config', 'created_imtbl_config');
357
359
  }
358
360
  }
359
361
  const API_KEY_PREFIX = 'sk_imapik-';
@@ -10938,7 +10940,7 @@ class MultiRollupApiClients {
10938
10940
  }
10939
10941
 
10940
10942
  // eslint-disable-next-line @typescript-eslint/naming-convention
10941
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.0' };
10943
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.2' };
10942
10944
  const createConfig = ({ basePath, headers, }) => {
10943
10945
  if (!basePath.trim()) {
10944
10946
  throw Error('basePath can not be empty');
@@ -11010,7 +11012,7 @@ class APIError extends Error {
11010
11012
 
11011
11013
  /* eslint-disable implicit-arrow-linebreak */
11012
11014
  const defaultHeaders = {
11013
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.0',
11015
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.2',
11014
11016
  };
11015
11017
  /**
11016
11018
  * createAPIConfiguration to create a custom Configuration
@@ -11449,7 +11451,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11449
11451
  chainID,
11450
11452
  coreContractAddress,
11451
11453
  registrationContractAddress,
11452
- sdkVersion: 'ts-immutable-sdk-1.1.0',
11454
+ sdkVersion: 'ts-immutable-sdk-1.1.2',
11453
11455
  });
11454
11456
  /**
11455
11457
  * Sets `sdkVersion` at the time of build
@@ -17711,29 +17713,6 @@ class RelayerClient {
17711
17713
  }
17712
17714
  }
17713
17715
 
17714
- const CHAIN_NAME_MAP = new Map([
17715
- [
17716
- ChainId$1.ETHEREUM,
17717
- ChainName$1.ETHEREUM,
17718
- ],
17719
- [
17720
- ChainId$1.SEPOLIA,
17721
- ChainName$1.SEPOLIA,
17722
- ],
17723
- [
17724
- ChainId$1.IMTBL_ZKEVM_MAINNET,
17725
- ChainName$1.IMTBL_ZKEVM_MAINNET,
17726
- ],
17727
- [
17728
- ChainId$1.IMTBL_ZKEVM_TESTNET,
17729
- ChainName$1.IMTBL_ZKEVM_TESTNET,
17730
- ],
17731
- [
17732
- ChainId$1.IMTBL_ZKEVM_DEVNET,
17733
- ChainName$1.IMTBL_ZKEVM_DEVNET,
17734
- ],
17735
- ]);
17736
-
17737
17716
  const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
17738
17717
  async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
17739
17718
  const web3Provider = new providers.Web3Provider(magicProvider);
@@ -17742,8 +17721,10 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
17742
17721
  const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
17743
17722
  const headers = { Authorization: `Bearer ${accessToken}` };
17744
17723
  const { chainId } = await jsonRpcProvider.ready;
17724
+ const eipChainId = getEip155ChainId(chainId);
17745
17725
  try {
17746
- const chainName = CHAIN_NAME_MAP.get(chainId);
17726
+ const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
17727
+ const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
17747
17728
  if (!chainName) {
17748
17729
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
17749
17730
  }
@@ -18204,7 +18185,7 @@ class Passport {
18204
18185
  imxApiClients,
18205
18186
  });
18206
18187
  setPassportClientId(passportModuleConfiguration.clientId);
18207
- track$1('passport', 'initialised');
18188
+ track('passport', 'initialised');
18208
18189
  }
18209
18190
  /**
18210
18191
  * @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
@@ -35614,7 +35595,8 @@ const CHILD_ERC20_BRIDGE = [
35614
35595
  const doesChainSupportEIP1559$1 = (feeData) => !!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
35615
35596
  const getGasPriceInWei$1 = (feeData) => {
35616
35597
  if (doesChainSupportEIP1559$1(feeData)) {
35617
- return BigNumber.from(feeData.maxFeePerGas).add(BigNumber.from(feeData.maxPriorityFeePerGas));
35598
+ // EIP1559 we need to add a tip for the miner to the base fee
35599
+ return BigNumber.from(feeData.lastBaseFeePerGas).add(BigNumber.from(feeData.maxPriorityFeePerGas));
35618
35600
  }
35619
35601
  if (feeData.gasPrice)
35620
35602
  return BigNumber.from(feeData.gasPrice);
@@ -35655,9 +35637,9 @@ var BridgeFeeActions;
35655
35637
  */
35656
35638
  var BridgeMethodsGasLimit;
35657
35639
  (function (BridgeMethodsGasLimit) {
35658
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 200000] = "DEPOSIT_SOURCE";
35640
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 150000] = "DEPOSIT_SOURCE";
35659
35641
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 200000] = "DEPOSIT_DESTINATION";
35660
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 200000] = "WITHDRAW_SOURCE";
35642
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 150000] = "WITHDRAW_SOURCE";
35661
35643
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 250000] = "WITHDRAW_DESTINATION";
35662
35644
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 200000] = "MAP_TOKEN_SOURCE";
35663
35645
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 200000] = "MAP_TOKEN_DESTINATION";
@@ -36622,6 +36604,7 @@ var Detail;
36622
36604
  Detail["PUBLISHABLE_API_KEY"] = "pak";
36623
36605
  Detail["IDENTITY"] = "uid";
36624
36606
  Detail["DOMAIN"] = "domain";
36607
+ Detail["SDK_VERSION"] = "sdkVersion";
36625
36608
  })(Detail || (Detail = {}));
36626
36609
  var Store;
36627
36610
  (function (Store) {
@@ -36715,10 +36698,6 @@ const getDetail = (key) => {
36715
36698
  const getAllDetails = () => RUNTIME_DETAILS;
36716
36699
  // Events
36717
36700
  const getEvents = () => EVENT_STORE;
36718
- const addEvent = (event) => {
36719
- EVENT_STORE.push(event);
36720
- setItem(Store.EVENTS, EVENT_STORE);
36721
- };
36722
36701
  const removeSentEvents = (numberOfEvents) => {
36723
36702
  EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
36724
36703
  setItem(Store.EVENTS, EVENT_STORE);
@@ -36736,6 +36715,8 @@ const flattenProperties = (properties) => {
36736
36715
  return propertyMap;
36737
36716
  };
36738
36717
 
36718
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
36719
+ const SDK_VERSION = '1.1.2';
36739
36720
  let initialised = false;
36740
36721
  const isInitialised = () => initialised;
36741
36722
  const getReferrer = () => {
@@ -36758,14 +36739,16 @@ const runtimeHost = () => {
36758
36739
  return new URL(window.location.href).hostname;
36759
36740
  };
36760
36741
  const getRuntimeDetails = () => {
36742
+ storeDetail(Detail.SDK_VERSION, SDK_VERSION);
36761
36743
  if (isNode()) {
36762
- return { browser: 'nodejs' };
36744
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION };
36763
36745
  }
36764
36746
  const domain = runtimeHost();
36765
36747
  if (domain) {
36766
36748
  storeDetail(Detail.DOMAIN, domain);
36767
36749
  }
36768
36750
  return {
36751
+ sdkVersion: SDK_VERSION,
36769
36752
  browser: window.navigator.userAgent,
36770
36753
  domain,
36771
36754
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -36774,7 +36757,6 @@ const getRuntimeDetails = () => {
36774
36757
  };
36775
36758
  const initialise = async () => {
36776
36759
  const runtimeDetails = flattenProperties(getRuntimeDetails());
36777
- // Get any existing runtimeId and send it along with the initialise
36778
36760
  const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
36779
36761
  const body = {
36780
36762
  version: 1,
@@ -36814,19 +36796,10 @@ function isTestEnvironment() {
36814
36796
  if (typeof process === 'undefined') {
36815
36797
  return false;
36816
36798
  }
36799
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
36800
+ // Just use process.env.CI for now.
36817
36801
  return process.env.JEST_WORKER_ID !== undefined;
36818
36802
  }
36819
-
36820
- // Store the event in the event store
36821
- const trackFn = (moduleName, eventName, properties) => {
36822
- const event = {
36823
- event: `${moduleName}.${eventName}`,
36824
- time: new Date().toISOString(),
36825
- ...(properties && { properties: flattenProperties(properties) }),
36826
- };
36827
- addEvent(event);
36828
- };
36829
- const track = errorBoundary(trackFn);
36830
36803
  // Sending events to the server
36831
36804
  const flushFn = async () => {
36832
36805
  // Don't flush if not initialised
@@ -36867,10 +36840,6 @@ if (!isTestEnvironment()) {
36867
36840
  errorBoundary(flushPoll)();
36868
36841
  }
36869
36842
 
36870
- track('metrics', 'sdk_version', {
36871
- version: '1.1.0',
36872
- });
36873
-
36874
36843
  var Environment;
36875
36844
  (function (Environment) {
36876
36845
  Environment["PRODUCTION"] = "production";
@@ -41850,7 +41819,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
41850
41819
  maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
41851
41820
  };
41852
41821
 
41853
- const SDK_VERSION_MARKER = '1.1.0';
41822
+ const SDK_VERSION_MARKER = '1.1.2';
41854
41823
  // This SDK version is replaced by the `yarn build` command ran on the root level
41855
41824
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41856
41825
 
@@ -42733,7 +42702,8 @@ async function gasEstimator(params, readOnlyProviders, config) {
42733
42702
  const doesChainSupportEIP1559 = (feeData) => !!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
42734
42703
  const getGasPriceInWei = (feeData) => {
42735
42704
  if (doesChainSupportEIP1559(feeData)) {
42736
- return ethers.BigNumber.from(feeData.maxFeePerGas).add(ethers.BigNumber.from(feeData.maxPriorityFeePerGas));
42705
+ // EIP1559 we need to add a tip for the miner to the base fee
42706
+ return ethers.BigNumber.from(feeData.lastBaseFeePerGas).add(ethers.BigNumber.from(feeData.maxPriorityFeePerGas));
42737
42707
  }
42738
42708
  if (feeData.gasPrice)
42739
42709
  return ethers.BigNumber.from(feeData.gasPrice);
@@ -45536,6 +45506,7 @@ class Checkout {
45536
45506
  this.readOnlyProviders = new Map();
45537
45507
  this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
45538
45508
  this.passport = config.passport;
45509
+ track('checkout_sdk', 'initialised');
45539
45510
  }
45540
45511
  /**
45541
45512
  * Loads the widgets bundle and initiate the widgets factory.
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ var Detail$1;
35
35
  Detail["PUBLISHABLE_API_KEY"] = "pak";
36
36
  Detail["IDENTITY"] = "uid";
37
37
  Detail["DOMAIN"] = "domain";
38
+ Detail["SDK_VERSION"] = "sdkVersion";
38
39
  })(Detail$1 || (Detail$1 = {}));
39
40
  var Store$1;
40
41
  (function (Store) {
@@ -128,7 +129,7 @@ const getDetail$1 = (key) => {
128
129
  const getAllDetails$1 = () => RUNTIME_DETAILS$1;
129
130
  // Events
130
131
  const getEvents$1 = () => EVENT_STORE$1;
131
- const addEvent$1 = (event) => {
132
+ const addEvent = (event) => {
132
133
  EVENT_STORE$1.push(event);
133
134
  setItem$1(Store$1.EVENTS, EVENT_STORE$1);
134
135
  };
@@ -149,6 +150,8 @@ const flattenProperties$1 = (properties) => {
149
150
  return propertyMap;
150
151
  };
151
152
 
153
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
154
+ const SDK_VERSION$1 = '1.1.2';
152
155
  let initialised$1 = false;
153
156
  const isInitialised$1 = () => initialised$1;
154
157
  const getReferrer$1 = () => {
@@ -171,14 +174,16 @@ const runtimeHost$1 = () => {
171
174
  return new URL(window.location.href).hostname;
172
175
  };
173
176
  const getRuntimeDetails$1 = () => {
177
+ storeDetail$1(Detail$1.SDK_VERSION, SDK_VERSION$1);
174
178
  if (isNode$1()) {
175
- return { browser: 'nodejs' };
179
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION$1 };
176
180
  }
177
181
  const domain = runtimeHost$1();
178
182
  if (domain) {
179
183
  storeDetail$1(Detail$1.DOMAIN, domain);
180
184
  }
181
185
  return {
186
+ sdkVersion: SDK_VERSION$1,
182
187
  browser: window.navigator.userAgent,
183
188
  domain,
184
189
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -187,7 +192,6 @@ const getRuntimeDetails$1 = () => {
187
192
  };
188
193
  const initialise$2 = async () => {
189
194
  const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
190
- // Get any existing runtimeId and send it along with the initialise
191
195
  const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
192
196
  const body = {
193
197
  version: 1,
@@ -227,19 +231,21 @@ function isTestEnvironment$1() {
227
231
  if (typeof process === 'undefined') {
228
232
  return false;
229
233
  }
234
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
235
+ // Just use process.env.CI for now.
230
236
  return process.env.JEST_WORKER_ID !== undefined;
231
237
  }
232
238
 
233
239
  // Store the event in the event store
234
- const trackFn$1 = (moduleName, eventName, properties) => {
240
+ const trackFn = (moduleName, eventName, properties) => {
235
241
  const event = {
236
242
  event: `${moduleName}.${eventName}`,
237
243
  time: new Date().toISOString(),
238
244
  ...(properties && { properties: flattenProperties$1(properties) }),
239
245
  };
240
- addEvent$1(event);
246
+ addEvent(event);
241
247
  };
242
- const track$1 = errorBoundary$1(trackFn$1);
248
+ const track = errorBoundary$1(trackFn);
243
249
  // Sending events to the server
244
250
  const flushFn$1 = async () => {
245
251
  // Don't flush if not initialised
@@ -297,7 +303,7 @@ const identifyFn = (params) => {
297
303
  return;
298
304
  }
299
305
  storeDetail$1(Detail$1.IDENTITY, identity);
300
- track$1('metrics', 'identify', params.traits);
306
+ track('metrics', 'identify', params.traits);
301
307
  };
302
308
  const identify = errorBoundary$1(identifyFn);
303
309
 
@@ -314,10 +320,6 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
314
320
  };
315
321
  const setPublishableApiKey = errorBoundary$1(setPublishableApiKeyFn);
316
322
 
317
- track$1('metrics', 'sdk_version', {
318
- version: '1.1.0',
319
- });
320
-
321
323
  var Environment$1;
322
324
  (function (Environment) {
323
325
  Environment["PRODUCTION"] = "production";
@@ -331,7 +333,7 @@ class ImmutableConfiguration {
331
333
  constructor(options) {
332
334
  this.environment = options.environment;
333
335
  setEnvironment(options.environment);
334
- track$1('config', 'created_imtbl_config');
336
+ track('config', 'created_imtbl_config');
335
337
  }
336
338
  }
337
339
  const API_KEY_PREFIX = 'sk_imapik-';
@@ -10916,7 +10918,7 @@ class MultiRollupApiClients {
10916
10918
  }
10917
10919
 
10918
10920
  // eslint-disable-next-line @typescript-eslint/naming-convention
10919
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.0' };
10921
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.2' };
10920
10922
  const createConfig = ({ basePath, headers, }) => {
10921
10923
  if (!basePath.trim()) {
10922
10924
  throw Error('basePath can not be empty');
@@ -10988,7 +10990,7 @@ class APIError extends Error {
10988
10990
 
10989
10991
  /* eslint-disable implicit-arrow-linebreak */
10990
10992
  const defaultHeaders = {
10991
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.0',
10993
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.2',
10992
10994
  };
10993
10995
  /**
10994
10996
  * createAPIConfiguration to create a custom Configuration
@@ -11427,7 +11429,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11427
11429
  chainID,
11428
11430
  coreContractAddress,
11429
11431
  registrationContractAddress,
11430
- sdkVersion: 'ts-immutable-sdk-1.1.0',
11432
+ sdkVersion: 'ts-immutable-sdk-1.1.2',
11431
11433
  });
11432
11434
  /**
11433
11435
  * Sets `sdkVersion` at the time of build
@@ -17689,29 +17691,6 @@ class RelayerClient {
17689
17691
  }
17690
17692
  }
17691
17693
 
17692
- const CHAIN_NAME_MAP = new Map([
17693
- [
17694
- ChainId$1.ETHEREUM,
17695
- ChainName$1.ETHEREUM,
17696
- ],
17697
- [
17698
- ChainId$1.SEPOLIA,
17699
- ChainName$1.SEPOLIA,
17700
- ],
17701
- [
17702
- ChainId$1.IMTBL_ZKEVM_MAINNET,
17703
- ChainName$1.IMTBL_ZKEVM_MAINNET,
17704
- ],
17705
- [
17706
- ChainId$1.IMTBL_ZKEVM_TESTNET,
17707
- ChainName$1.IMTBL_ZKEVM_TESTNET,
17708
- ],
17709
- [
17710
- ChainId$1.IMTBL_ZKEVM_DEVNET,
17711
- ChainName$1.IMTBL_ZKEVM_DEVNET,
17712
- ],
17713
- ]);
17714
-
17715
17694
  const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
17716
17695
  async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
17717
17696
  const web3Provider = new Web3Provider(magicProvider);
@@ -17720,8 +17699,10 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
17720
17699
  const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
17721
17700
  const headers = { Authorization: `Bearer ${accessToken}` };
17722
17701
  const { chainId } = await jsonRpcProvider.ready;
17702
+ const eipChainId = getEip155ChainId(chainId);
17723
17703
  try {
17724
- const chainName = CHAIN_NAME_MAP.get(chainId);
17704
+ const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
17705
+ const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
17725
17706
  if (!chainName) {
17726
17707
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
17727
17708
  }
@@ -18182,7 +18163,7 @@ class Passport {
18182
18163
  imxApiClients,
18183
18164
  });
18184
18165
  setPassportClientId(passportModuleConfiguration.clientId);
18185
- track$1('passport', 'initialised');
18166
+ track('passport', 'initialised');
18186
18167
  }
18187
18168
  /**
18188
18169
  * @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
@@ -35592,7 +35573,8 @@ const CHILD_ERC20_BRIDGE = [
35592
35573
  const doesChainSupportEIP1559$1 = (feeData) => !!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
35593
35574
  const getGasPriceInWei$1 = (feeData) => {
35594
35575
  if (doesChainSupportEIP1559$1(feeData)) {
35595
- return BigNumber.from(feeData.maxFeePerGas).add(BigNumber.from(feeData.maxPriorityFeePerGas));
35576
+ // EIP1559 we need to add a tip for the miner to the base fee
35577
+ return BigNumber.from(feeData.lastBaseFeePerGas).add(BigNumber.from(feeData.maxPriorityFeePerGas));
35596
35578
  }
35597
35579
  if (feeData.gasPrice)
35598
35580
  return BigNumber.from(feeData.gasPrice);
@@ -35633,9 +35615,9 @@ var BridgeFeeActions;
35633
35615
  */
35634
35616
  var BridgeMethodsGasLimit;
35635
35617
  (function (BridgeMethodsGasLimit) {
35636
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 200000] = "DEPOSIT_SOURCE";
35618
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 150000] = "DEPOSIT_SOURCE";
35637
35619
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 200000] = "DEPOSIT_DESTINATION";
35638
- BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 200000] = "WITHDRAW_SOURCE";
35620
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 150000] = "WITHDRAW_SOURCE";
35639
35621
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 250000] = "WITHDRAW_DESTINATION";
35640
35622
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 200000] = "MAP_TOKEN_SOURCE";
35641
35623
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 200000] = "MAP_TOKEN_DESTINATION";
@@ -36600,6 +36582,7 @@ var Detail;
36600
36582
  Detail["PUBLISHABLE_API_KEY"] = "pak";
36601
36583
  Detail["IDENTITY"] = "uid";
36602
36584
  Detail["DOMAIN"] = "domain";
36585
+ Detail["SDK_VERSION"] = "sdkVersion";
36603
36586
  })(Detail || (Detail = {}));
36604
36587
  var Store;
36605
36588
  (function (Store) {
@@ -36693,10 +36676,6 @@ const getDetail = (key) => {
36693
36676
  const getAllDetails = () => RUNTIME_DETAILS;
36694
36677
  // Events
36695
36678
  const getEvents = () => EVENT_STORE;
36696
- const addEvent = (event) => {
36697
- EVENT_STORE.push(event);
36698
- setItem(Store.EVENTS, EVENT_STORE);
36699
- };
36700
36679
  const removeSentEvents = (numberOfEvents) => {
36701
36680
  EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
36702
36681
  setItem(Store.EVENTS, EVENT_STORE);
@@ -36714,6 +36693,8 @@ const flattenProperties = (properties) => {
36714
36693
  return propertyMap;
36715
36694
  };
36716
36695
 
36696
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
36697
+ const SDK_VERSION = '1.1.2';
36717
36698
  let initialised = false;
36718
36699
  const isInitialised = () => initialised;
36719
36700
  const getReferrer = () => {
@@ -36736,14 +36717,16 @@ const runtimeHost = () => {
36736
36717
  return new URL(window.location.href).hostname;
36737
36718
  };
36738
36719
  const getRuntimeDetails = () => {
36720
+ storeDetail(Detail.SDK_VERSION, SDK_VERSION);
36739
36721
  if (isNode()) {
36740
- return { browser: 'nodejs' };
36722
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION };
36741
36723
  }
36742
36724
  const domain = runtimeHost();
36743
36725
  if (domain) {
36744
36726
  storeDetail(Detail.DOMAIN, domain);
36745
36727
  }
36746
36728
  return {
36729
+ sdkVersion: SDK_VERSION,
36747
36730
  browser: window.navigator.userAgent,
36748
36731
  domain,
36749
36732
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -36752,7 +36735,6 @@ const getRuntimeDetails = () => {
36752
36735
  };
36753
36736
  const initialise = async () => {
36754
36737
  const runtimeDetails = flattenProperties(getRuntimeDetails());
36755
- // Get any existing runtimeId and send it along with the initialise
36756
36738
  const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
36757
36739
  const body = {
36758
36740
  version: 1,
@@ -36792,19 +36774,10 @@ function isTestEnvironment() {
36792
36774
  if (typeof process === 'undefined') {
36793
36775
  return false;
36794
36776
  }
36777
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
36778
+ // Just use process.env.CI for now.
36795
36779
  return process.env.JEST_WORKER_ID !== undefined;
36796
36780
  }
36797
-
36798
- // Store the event in the event store
36799
- const trackFn = (moduleName, eventName, properties) => {
36800
- const event = {
36801
- event: `${moduleName}.${eventName}`,
36802
- time: new Date().toISOString(),
36803
- ...(properties && { properties: flattenProperties(properties) }),
36804
- };
36805
- addEvent(event);
36806
- };
36807
- const track = errorBoundary(trackFn);
36808
36781
  // Sending events to the server
36809
36782
  const flushFn = async () => {
36810
36783
  // Don't flush if not initialised
@@ -36845,10 +36818,6 @@ if (!isTestEnvironment()) {
36845
36818
  errorBoundary(flushPoll)();
36846
36819
  }
36847
36820
 
36848
- track('metrics', 'sdk_version', {
36849
- version: '1.1.0',
36850
- });
36851
-
36852
36821
  var Environment;
36853
36822
  (function (Environment) {
36854
36823
  Environment["PRODUCTION"] = "production";
@@ -41828,7 +41797,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
41828
41797
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
41829
41798
  };
41830
41799
 
41831
- const SDK_VERSION_MARKER = '1.1.0';
41800
+ const SDK_VERSION_MARKER = '1.1.2';
41832
41801
  // This SDK version is replaced by the `yarn build` command ran on the root level
41833
41802
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41834
41803
 
@@ -42711,7 +42680,8 @@ async function gasEstimator(params, readOnlyProviders, config) {
42711
42680
  const doesChainSupportEIP1559 = (feeData) => !!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
42712
42681
  const getGasPriceInWei = (feeData) => {
42713
42682
  if (doesChainSupportEIP1559(feeData)) {
42714
- return BigNumber$1.from(feeData.maxFeePerGas).add(BigNumber$1.from(feeData.maxPriorityFeePerGas));
42683
+ // EIP1559 we need to add a tip for the miner to the base fee
42684
+ return BigNumber$1.from(feeData.lastBaseFeePerGas).add(BigNumber$1.from(feeData.maxPriorityFeePerGas));
42715
42685
  }
42716
42686
  if (feeData.gasPrice)
42717
42687
  return BigNumber$1.from(feeData.gasPrice);
@@ -45514,6 +45484,7 @@ class Checkout {
45514
45484
  this.readOnlyProviders = new Map();
45515
45485
  this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
45516
45486
  this.passport = config.passport;
45487
+ track('checkout_sdk', 'initialised');
45517
45488
  }
45518
45489
  /**
45519
45490
  * Loads the widgets bundle and initiate the widgets factory.