@imtbl/sdk 0.27.4 → 0.27.5

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
@@ -3631,7 +3631,7 @@ class MultiRollupApiClients {
3631
3631
  }
3632
3632
 
3633
3633
  // eslint-disable-next-line @typescript-eslint/naming-convention
3634
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.4' };
3634
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.5' };
3635
3635
  const createConfig = ({ basePath, headers, }) => {
3636
3636
  if (!basePath.trim()) {
3637
3637
  throw Error('basePath can not be empty');
@@ -3691,7 +3691,7 @@ class APIError extends Error {
3691
3691
 
3692
3692
  /* eslint-disable implicit-arrow-linebreak */
3693
3693
  const defaultHeaders = {
3694
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.4',
3694
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.5',
3695
3695
  };
3696
3696
  /**
3697
3697
  * createAPIConfiguration to create a custom Configuration
@@ -4102,7 +4102,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4102
4102
  chainID,
4103
4103
  coreContractAddress,
4104
4104
  registrationContractAddress,
4105
- sdkVersion: 'ts-immutable-sdk-0.27.4',
4105
+ sdkVersion: 'ts-immutable-sdk-0.27.5',
4106
4106
  });
4107
4107
  /**
4108
4108
  * Sets `sdkVersion` at the time of build
@@ -9027,13 +9027,14 @@ class MagicAdapter {
9027
9027
  magicClient;
9028
9028
  constructor(config) {
9029
9029
  this.config = config;
9030
+ this.magicClient = new magicSdk.Magic(this.config.magicPublishableApiKey, {
9031
+ extensions: [new oidc.OpenIdExtension()],
9032
+ network: config.network,
9033
+ });
9034
+ this.magicClient.preload();
9030
9035
  }
9031
- async login(idToken, network) {
9036
+ async login(idToken) {
9032
9037
  return withPassportError(async () => {
9033
- this.magicClient = new magicSdk.Magic(this.config.magicPublishableApiKey, {
9034
- extensions: [new oidc.OpenIdExtension()],
9035
- network,
9036
- });
9037
9038
  await this.magicClient.openid.loginWithOIDC({
9038
9039
  jwt: idToken,
9039
9040
  providerId: this.config.magicProviderId,
@@ -9042,7 +9043,7 @@ class MagicAdapter {
9042
9043
  }, PassportErrorType.WALLET_CONNECTION_ERROR);
9043
9044
  }
9044
9045
  async logout() {
9045
- if (this.magicClient?.user) {
9046
+ if (this.magicClient.user) {
9046
9047
  await this.magicClient.user.logout();
9047
9048
  }
9048
9049
  }
@@ -9407,8 +9408,10 @@ async function cancelOrder$1({ user, starkSigner, request, ordersApi, guardianCl
9407
9408
 
9408
9409
  async function registerPassport({ ethSigner, starkSigner, usersApi }, authorization) {
9409
9410
  return withPassportError(async () => {
9410
- const userAddress = await ethSigner.getAddress();
9411
- const starkPublicKey = await starkSigner.getAddress();
9411
+ const [userAddress, starkPublicKey] = await Promise.all([
9412
+ ethSigner.getAddress(),
9413
+ starkSigner.getAddress(),
9414
+ ]);
9412
9415
  const signableResult = await usersApi.getSignableRegistrationOffchain({
9413
9416
  getSignableRegistrationRequest: {
9414
9417
  ether_key: userAddress,
@@ -9416,8 +9419,10 @@ async function registerPassport({ ethSigner, starkSigner, usersApi }, authorizat
9416
9419
  },
9417
9420
  });
9418
9421
  const { signable_message: signableMessage, payload_hash: payloadHash } = signableResult.data;
9419
- const ethSignature = await signRaw(signableMessage, ethSigner);
9420
- const starkSignature = await starkSigner.signMessage(payloadHash);
9422
+ const [ethSignature, starkSignature] = await Promise.all([
9423
+ signRaw(signableMessage, ethSigner),
9424
+ starkSigner.signMessage(payloadHash),
9425
+ ]);
9421
9426
  const response = await usersApi.registerPassportUser({
9422
9427
  authorization: `Bearer ${authorization}`,
9423
9428
  registerPassportUserRequest: {
@@ -9742,7 +9747,7 @@ class PassportImxProviderFactory {
9742
9747
  if (!user.idToken) {
9743
9748
  throw new PassportError('Failed to initialise', PassportErrorType.WALLET_CONNECTION_ERROR);
9744
9749
  }
9745
- const magicRpcProvider = await this.magicAdapter.login(user.idToken, this.config.network);
9750
+ const magicRpcProvider = await this.magicAdapter.login(user.idToken);
9746
9751
  const web3Provider = new providers.Web3Provider(magicRpcProvider);
9747
9752
  const ethSigner = web3Provider.getSigner();
9748
9753
  const starkSigner = await getStarkSigner(ethSigner);
@@ -10288,7 +10293,7 @@ const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupAp
10288
10293
  if (!user.idToken) {
10289
10294
  throw new Error('User is missing idToken');
10290
10295
  }
10291
- const magicProvider = await magicAdapter.login(user.idToken, config.network);
10296
+ const magicProvider = await magicAdapter.login(user.idToken);
10292
10297
  if (!user.zkEvm) {
10293
10298
  // Generate counterfactual address and retrieve updated Auth0 user
10294
10299
  const userZkevm = await registerZkEvmUser({
@@ -28707,7 +28712,7 @@ const CONTRACTS_FOR_CHAIN_ID = {
28707
28712
  multicall: '0xD17c98b38bA28c7eA1080317EB9AB2b9663BEd92',
28708
28713
  coreFactory: '0x8AC26EfCbf5D700b37A27aA00E6934e6904e7B8e',
28709
28714
  quoterV2: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
28710
- peripheryRouter: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
28715
+ peripheryRouter: '0x5893A5c7bc615Dfd36D7383366d00FFFca5f7178',
28711
28716
  secondaryFee: '0x5893A5c7bc615Dfd36D7383366d00FFFca5f7178',
28712
28717
  },
28713
28718
  };
@@ -33063,7 +33068,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
33063
33068
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
33064
33069
 
33065
33070
 
33066
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.4";
33071
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.5";
33067
33072
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
33068
33073
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
33069
33074
 
package/dist/index.js CHANGED
@@ -3609,7 +3609,7 @@ class MultiRollupApiClients {
3609
3609
  }
3610
3610
 
3611
3611
  // eslint-disable-next-line @typescript-eslint/naming-convention
3612
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.4' };
3612
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.5' };
3613
3613
  const createConfig = ({ basePath, headers, }) => {
3614
3614
  if (!basePath.trim()) {
3615
3615
  throw Error('basePath can not be empty');
@@ -3669,7 +3669,7 @@ class APIError extends Error {
3669
3669
 
3670
3670
  /* eslint-disable implicit-arrow-linebreak */
3671
3671
  const defaultHeaders = {
3672
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.4',
3672
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.5',
3673
3673
  };
3674
3674
  /**
3675
3675
  * createAPIConfiguration to create a custom Configuration
@@ -4080,7 +4080,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4080
4080
  chainID,
4081
4081
  coreContractAddress,
4082
4082
  registrationContractAddress,
4083
- sdkVersion: 'ts-immutable-sdk-0.27.4',
4083
+ sdkVersion: 'ts-immutable-sdk-0.27.5',
4084
4084
  });
4085
4085
  /**
4086
4086
  * Sets `sdkVersion` at the time of build
@@ -9005,13 +9005,14 @@ class MagicAdapter {
9005
9005
  magicClient;
9006
9006
  constructor(config) {
9007
9007
  this.config = config;
9008
+ this.magicClient = new Magic(this.config.magicPublishableApiKey, {
9009
+ extensions: [new OpenIdExtension()],
9010
+ network: config.network,
9011
+ });
9012
+ this.magicClient.preload();
9008
9013
  }
9009
- async login(idToken, network) {
9014
+ async login(idToken) {
9010
9015
  return withPassportError(async () => {
9011
- this.magicClient = new Magic(this.config.magicPublishableApiKey, {
9012
- extensions: [new OpenIdExtension()],
9013
- network,
9014
- });
9015
9016
  await this.magicClient.openid.loginWithOIDC({
9016
9017
  jwt: idToken,
9017
9018
  providerId: this.config.magicProviderId,
@@ -9020,7 +9021,7 @@ class MagicAdapter {
9020
9021
  }, PassportErrorType.WALLET_CONNECTION_ERROR);
9021
9022
  }
9022
9023
  async logout() {
9023
- if (this.magicClient?.user) {
9024
+ if (this.magicClient.user) {
9024
9025
  await this.magicClient.user.logout();
9025
9026
  }
9026
9027
  }
@@ -9385,8 +9386,10 @@ async function cancelOrder$1({ user, starkSigner, request, ordersApi, guardianCl
9385
9386
 
9386
9387
  async function registerPassport({ ethSigner, starkSigner, usersApi }, authorization) {
9387
9388
  return withPassportError(async () => {
9388
- const userAddress = await ethSigner.getAddress();
9389
- const starkPublicKey = await starkSigner.getAddress();
9389
+ const [userAddress, starkPublicKey] = await Promise.all([
9390
+ ethSigner.getAddress(),
9391
+ starkSigner.getAddress(),
9392
+ ]);
9390
9393
  const signableResult = await usersApi.getSignableRegistrationOffchain({
9391
9394
  getSignableRegistrationRequest: {
9392
9395
  ether_key: userAddress,
@@ -9394,8 +9397,10 @@ async function registerPassport({ ethSigner, starkSigner, usersApi }, authorizat
9394
9397
  },
9395
9398
  });
9396
9399
  const { signable_message: signableMessage, payload_hash: payloadHash } = signableResult.data;
9397
- const ethSignature = await signRaw(signableMessage, ethSigner);
9398
- const starkSignature = await starkSigner.signMessage(payloadHash);
9400
+ const [ethSignature, starkSignature] = await Promise.all([
9401
+ signRaw(signableMessage, ethSigner),
9402
+ starkSigner.signMessage(payloadHash),
9403
+ ]);
9399
9404
  const response = await usersApi.registerPassportUser({
9400
9405
  authorization: `Bearer ${authorization}`,
9401
9406
  registerPassportUserRequest: {
@@ -9720,7 +9725,7 @@ class PassportImxProviderFactory {
9720
9725
  if (!user.idToken) {
9721
9726
  throw new PassportError('Failed to initialise', PassportErrorType.WALLET_CONNECTION_ERROR);
9722
9727
  }
9723
- const magicRpcProvider = await this.magicAdapter.login(user.idToken, this.config.network);
9728
+ const magicRpcProvider = await this.magicAdapter.login(user.idToken);
9724
9729
  const web3Provider = new Web3Provider(magicRpcProvider);
9725
9730
  const ethSigner = web3Provider.getSigner();
9726
9731
  const starkSigner = await getStarkSigner(ethSigner);
@@ -10266,7 +10271,7 @@ const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupAp
10266
10271
  if (!user.idToken) {
10267
10272
  throw new Error('User is missing idToken');
10268
10273
  }
10269
- const magicProvider = await magicAdapter.login(user.idToken, config.network);
10274
+ const magicProvider = await magicAdapter.login(user.idToken);
10270
10275
  if (!user.zkEvm) {
10271
10276
  // Generate counterfactual address and retrieve updated Auth0 user
10272
10277
  const userZkevm = await registerZkEvmUser({
@@ -28685,7 +28690,7 @@ const CONTRACTS_FOR_CHAIN_ID = {
28685
28690
  multicall: '0xD17c98b38bA28c7eA1080317EB9AB2b9663BEd92',
28686
28691
  coreFactory: '0x8AC26EfCbf5D700b37A27aA00E6934e6904e7B8e',
28687
28692
  quoterV2: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44',
28688
- peripheryRouter: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
28693
+ peripheryRouter: '0x5893A5c7bc615Dfd36D7383366d00FFFca5f7178',
28689
28694
  secondaryFee: '0x5893A5c7bc615Dfd36D7383366d00FFFca5f7178',
28690
28695
  },
28691
28696
  };
@@ -33041,7 +33046,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
33041
33046
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
33042
33047
 
33043
33048
 
33044
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.4";
33049
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.5";
33045
33050
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
33046
33051
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
33047
33052
 
package/dist/passport.js CHANGED
@@ -2072,7 +2072,7 @@ class MultiRollupApiClients {
2072
2072
  }
2073
2073
 
2074
2074
  // eslint-disable-next-line @typescript-eslint/naming-convention
2075
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.27.4' };
2075
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.27.5' };
2076
2076
  const createConfig = ({ basePath, headers, }) => {
2077
2077
  if (!basePath.trim()) {
2078
2078
  throw Error('basePath can not be empty');
@@ -2128,7 +2128,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2128
2128
  chainID,
2129
2129
  coreContractAddress,
2130
2130
  registrationContractAddress,
2131
- sdkVersion: 'ts-immutable-sdk-0.27.4',
2131
+ sdkVersion: 'ts-immutable-sdk-0.27.5',
2132
2132
  });
2133
2133
  /**
2134
2134
  * Sets `sdkVersion` at the time of build
@@ -7036,13 +7036,14 @@ class MagicAdapter {
7036
7036
  magicClient;
7037
7037
  constructor(config) {
7038
7038
  this.config = config;
7039
+ this.magicClient = new Magic(this.config.magicPublishableApiKey, {
7040
+ extensions: [new OpenIdExtension()],
7041
+ network: config.network,
7042
+ });
7043
+ this.magicClient.preload();
7039
7044
  }
7040
- async login(idToken, network) {
7045
+ async login(idToken) {
7041
7046
  return withPassportError(async () => {
7042
- this.magicClient = new Magic(this.config.magicPublishableApiKey, {
7043
- extensions: [new OpenIdExtension()],
7044
- network,
7045
- });
7046
7047
  await this.magicClient.openid.loginWithOIDC({
7047
7048
  jwt: idToken,
7048
7049
  providerId: this.config.magicProviderId,
@@ -7051,7 +7052,7 @@ class MagicAdapter {
7051
7052
  }, PassportErrorType.WALLET_CONNECTION_ERROR);
7052
7053
  }
7053
7054
  async logout() {
7054
- if (this.magicClient?.user) {
7055
+ if (this.magicClient.user) {
7055
7056
  await this.magicClient.user.logout();
7056
7057
  }
7057
7058
  }
@@ -7416,8 +7417,10 @@ async function cancelOrder({ user, starkSigner, request, ordersApi, guardianClie
7416
7417
 
7417
7418
  async function registerPassport({ ethSigner, starkSigner, usersApi }, authorization) {
7418
7419
  return withPassportError(async () => {
7419
- const userAddress = await ethSigner.getAddress();
7420
- const starkPublicKey = await starkSigner.getAddress();
7420
+ const [userAddress, starkPublicKey] = await Promise.all([
7421
+ ethSigner.getAddress(),
7422
+ starkSigner.getAddress(),
7423
+ ]);
7421
7424
  const signableResult = await usersApi.getSignableRegistrationOffchain({
7422
7425
  getSignableRegistrationRequest: {
7423
7426
  ether_key: userAddress,
@@ -7425,8 +7428,10 @@ async function registerPassport({ ethSigner, starkSigner, usersApi }, authorizat
7425
7428
  },
7426
7429
  });
7427
7430
  const { signable_message: signableMessage, payload_hash: payloadHash } = signableResult.data;
7428
- const ethSignature = await signRaw(signableMessage, ethSigner);
7429
- const starkSignature = await starkSigner.signMessage(payloadHash);
7431
+ const [ethSignature, starkSignature] = await Promise.all([
7432
+ signRaw(signableMessage, ethSigner),
7433
+ starkSigner.signMessage(payloadHash),
7434
+ ]);
7430
7435
  const response = await usersApi.registerPassportUser({
7431
7436
  authorization: `Bearer ${authorization}`,
7432
7437
  registerPassportUserRequest: {
@@ -7751,7 +7756,7 @@ class PassportImxProviderFactory {
7751
7756
  if (!user.idToken) {
7752
7757
  throw new PassportError('Failed to initialise', PassportErrorType.WALLET_CONNECTION_ERROR);
7753
7758
  }
7754
- const magicRpcProvider = await this.magicAdapter.login(user.idToken, this.config.network);
7759
+ const magicRpcProvider = await this.magicAdapter.login(user.idToken);
7755
7760
  const web3Provider = new Web3Provider(magicRpcProvider);
7756
7761
  const ethSigner = web3Provider.getSigner();
7757
7762
  const starkSigner = await getStarkSigner(ethSigner);
@@ -8297,7 +8302,7 @@ const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupAp
8297
8302
  if (!user.idToken) {
8298
8303
  throw new Error('User is missing idToken');
8299
8304
  }
8300
- const magicProvider = await magicAdapter.login(user.idToken, config.network);
8305
+ const magicProvider = await magicAdapter.login(user.idToken);
8301
8306
  if (!user.zkEvm) {
8302
8307
  // Generate counterfactual address and retrieve updated Auth0 user
8303
8308
  const userZkevm = await registerZkEvmUser({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.27.4",
4
+ "version": "0.27.5",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",