@imtbl/sdk 1.4.1 → 1.5.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.
package/dist/passport.js CHANGED
@@ -9136,7 +9136,7 @@ class MultiRollupApiClients {
9136
9136
  }
9137
9137
 
9138
9138
  // eslint-disable-next-line @typescript-eslint/naming-convention
9139
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.4.1' };
9139
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.5.0' };
9140
9140
  const createConfig = ({ basePath, headers, }) => {
9141
9141
  if (!basePath.trim()) {
9142
9142
  throw Error('basePath can not be empty');
@@ -9316,7 +9316,7 @@ const flattenProperties = (properties) => {
9316
9316
  };
9317
9317
 
9318
9318
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
9319
- const SDK_VERSION = '1.4.1';
9319
+ const SDK_VERSION = '1.5.0';
9320
9320
  let initialised = false;
9321
9321
  const isInitialised = () => initialised;
9322
9322
  const getReferrer = () => {
@@ -9491,7 +9491,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
9491
9491
  chainID,
9492
9492
  coreContractAddress,
9493
9493
  registrationContractAddress,
9494
- sdkVersion: 'ts-immutable-sdk-1.4.1',
9494
+ sdkVersion: 'ts-immutable-sdk-1.5.0',
9495
9495
  });
9496
9496
  /**
9497
9497
  * Sets `sdkVersion` at the time of build
@@ -16181,6 +16181,52 @@ class ZkEvmProvider {
16181
16181
  }
16182
16182
  }
16183
16183
 
16184
+ const buildImxClientConfig = (passportModuleConfiguration) => {
16185
+ if (passportModuleConfiguration.overrides) {
16186
+ return createConfig({ basePath: passportModuleConfiguration.overrides.imxPublicApiDomain });
16187
+ }
16188
+ if (passportModuleConfiguration.baseConfig.environment === Environment.SANDBOX) {
16189
+ return imxApiConfig.getSandbox();
16190
+ }
16191
+ return imxApiConfig.getProduction();
16192
+ };
16193
+ const buildImxApiClients = (passportModuleConfiguration) => {
16194
+ if (passportModuleConfiguration.overrides?.imxApiClients)
16195
+ return passportModuleConfiguration.overrides.imxApiClients;
16196
+ const config = buildImxClientConfig(passportModuleConfiguration);
16197
+ return new ImxApiClients(config);
16198
+ };
16199
+ const buildPrivateVars = (passportModuleConfiguration) => {
16200
+ const config = new PassportConfiguration(passportModuleConfiguration);
16201
+ const authManager = new AuthManager(config);
16202
+ const magicAdapter = new MagicAdapter(config);
16203
+ const confirmationScreen = new ConfirmationScreen(config);
16204
+ const multiRollupApiClients = new MultiRollupApiClients(config.multiRollupConfig);
16205
+ const passportEventEmitter = new TypedEventEmitter();
16206
+ const immutableXClient = passportModuleConfiguration.overrides
16207
+ ? passportModuleConfiguration.overrides.immutableXClient
16208
+ : new IMXClient({ baseConfig: passportModuleConfiguration.baseConfig });
16209
+ const imxApiClients = buildImxApiClients(passportModuleConfiguration);
16210
+ const passportImxProviderFactory = new PassportImxProviderFactory({
16211
+ authManager,
16212
+ config,
16213
+ confirmationScreen,
16214
+ immutableXClient,
16215
+ magicAdapter,
16216
+ passportEventEmitter,
16217
+ imxApiClients,
16218
+ });
16219
+ return {
16220
+ config,
16221
+ authManager,
16222
+ magicAdapter,
16223
+ confirmationScreen,
16224
+ immutableXClient,
16225
+ multiRollupApiClients,
16226
+ passportEventEmitter,
16227
+ passportImxProviderFactory,
16228
+ };
16229
+ };
16184
16230
  class Passport {
16185
16231
  authManager;
16186
16232
  config;
@@ -16191,30 +16237,15 @@ class Passport {
16191
16237
  passportImxProviderFactory;
16192
16238
  passportEventEmitter;
16193
16239
  constructor(passportModuleConfiguration) {
16194
- this.config = new PassportConfiguration(passportModuleConfiguration);
16195
- this.authManager = new AuthManager(this.config);
16196
- this.magicAdapter = new MagicAdapter(this.config);
16197
- this.confirmationScreen = new ConfirmationScreen(this.config);
16198
- this.immutableXClient = passportModuleConfiguration.overrides?.immutableXClient
16199
- || new IMXClient({
16200
- baseConfig: passportModuleConfiguration.baseConfig,
16201
- });
16202
- this.multiRollupApiClients = new MultiRollupApiClients(this.config.multiRollupConfig);
16203
- this.passportEventEmitter = new TypedEventEmitter();
16204
- const imxClientConfig = this.config.baseConfig.environment === Environment.PRODUCTION
16205
- ? imxApiConfig.getProduction()
16206
- : imxApiConfig.getSandbox();
16207
- const imxApiClients = passportModuleConfiguration.overrides?.imxApiClients
16208
- || new ImxApiClients(imxClientConfig);
16209
- this.passportImxProviderFactory = new PassportImxProviderFactory({
16210
- authManager: this.authManager,
16211
- config: this.config,
16212
- confirmationScreen: this.confirmationScreen,
16213
- immutableXClient: this.immutableXClient,
16214
- magicAdapter: this.magicAdapter,
16215
- passportEventEmitter: this.passportEventEmitter,
16216
- imxApiClients,
16217
- });
16240
+ const privateVars = buildPrivateVars(passportModuleConfiguration);
16241
+ this.config = privateVars.config;
16242
+ this.authManager = privateVars.authManager;
16243
+ this.magicAdapter = privateVars.magicAdapter;
16244
+ this.confirmationScreen = privateVars.confirmationScreen;
16245
+ this.immutableXClient = privateVars.immutableXClient;
16246
+ this.multiRollupApiClients = privateVars.multiRollupApiClients;
16247
+ this.passportEventEmitter = privateVars.passportEventEmitter;
16248
+ this.passportImxProviderFactory = privateVars.passportImxProviderFactory;
16218
16249
  setPassportClientId(passportModuleConfiguration.clientId);
16219
16250
  track('passport', 'initialised');
16220
16251
  }
package/dist/x.js CHANGED
@@ -131,7 +131,7 @@ const flattenProperties = (properties) => {
131
131
  };
132
132
 
133
133
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
134
- const SDK_VERSION = '1.4.1';
134
+ const SDK_VERSION = '1.5.0';
135
135
  let initialised = false;
136
136
  const isInitialised = () => initialised;
137
137
  const getReferrer = () => {
@@ -270,7 +270,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
270
270
  chainID,
271
271
  coreContractAddress,
272
272
  registrationContractAddress,
273
- sdkVersion: 'ts-immutable-sdk-1.4.1',
273
+ sdkVersion: 'ts-immutable-sdk-1.5.0',
274
274
  });
275
275
  /**
276
276
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "1.4.1",
4
+ "version": "1.5.0",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",