@imtbl/sdk 0.44.0 → 0.44.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.
package/dist/index.cjs CHANGED
@@ -10641,7 +10641,7 @@ class MultiRollupApiClients {
10641
10641
  }
10642
10642
 
10643
10643
  // eslint-disable-next-line @typescript-eslint/naming-convention
10644
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.0' };
10644
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.1' };
10645
10645
  const createConfig = ({ basePath, headers, }) => {
10646
10646
  if (!basePath.trim()) {
10647
10647
  throw Error('basePath can not be empty');
@@ -10713,7 +10713,7 @@ class APIError extends Error {
10713
10713
 
10714
10714
  /* eslint-disable implicit-arrow-linebreak */
10715
10715
  const defaultHeaders = {
10716
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.0',
10716
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.1',
10717
10717
  };
10718
10718
  /**
10719
10719
  * createAPIConfiguration to create a custom Configuration
@@ -11152,7 +11152,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11152
11152
  chainID,
11153
11153
  coreContractAddress,
11154
11154
  registrationContractAddress,
11155
- sdkVersion: 'ts-immutable-sdk-0.44.0',
11155
+ sdkVersion: 'ts-immutable-sdk-0.44.1',
11156
11156
  });
11157
11157
  /**
11158
11158
  * Sets `sdkVersion` at the time of build
@@ -17303,27 +17303,43 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
17303
17303
  const types = { ...typedData.types };
17304
17304
  // @ts-ignore
17305
17305
  delete types.EIP712Domain;
17306
- // eslint-disable-next-line no-underscore-dangle
17307
- const digest = ethers.ethers.utils._TypedDataEncoder.hash(typedData.domain, types, typedData.message);
17308
- const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
17309
- const hash = ethers.ethers.utils.keccak256(completePayload);
17310
- // Sign the digest
17306
+ // Hash the EIP712 payload and generate the complete payload
17307
+ const { _TypedDataEncoder: typedDataEncoder } = ethers.ethers.utils;
17308
+ const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
17309
+ const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
17310
+ const hash = ethers.ethers.utils.keccak256(messageSubDigest);
17311
+ // Sign the sub digest
17312
+ // https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
17311
17313
  const hashArray = ethers.ethers.utils.arrayify(hash);
17312
17314
  const ethsigNoType = await signer.signMessage(hashArray);
17313
17315
  const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
17314
- const { signers } = decodeRelayerTypedDataSignature(relayerSignature);
17316
+ // Combine the relayer and user signatures; sort by address to match the imageHash order
17317
+ const { signers: relayerSigners } = decodeRelayerTypedDataSignature(relayerSignature);
17318
+ const combinedSigners = [
17319
+ ...relayerSigners,
17320
+ {
17321
+ isDynamic: false,
17322
+ unrecovered: true,
17323
+ weight: SIGNATURE_WEIGHT,
17324
+ signature: signedDigest,
17325
+ address: await signer.getAddress(),
17326
+ },
17327
+ ];
17328
+ const sortedSigners = combinedSigners.sort((a, b) => {
17329
+ const bigA = ethers.BigNumber.from(a.address);
17330
+ const bigB = ethers.BigNumber.from(b.address);
17331
+ if (bigA.lte(bigB)) {
17332
+ return -1;
17333
+ }
17334
+ if (bigA.eq(bigB)) {
17335
+ return 0;
17336
+ }
17337
+ return 1;
17338
+ });
17315
17339
  return core.v1.signature.encodeSignature({
17316
17340
  version: 1,
17317
17341
  threshold: EIP712_SIGNATURE_THRESHOLD,
17318
- signers: [
17319
- ...signers,
17320
- {
17321
- isDynamic: false,
17322
- unrecovered: true,
17323
- weight: SIGNATURE_WEIGHT,
17324
- signature: signedDigest,
17325
- },
17326
- ],
17342
+ signers: sortedSigners,
17327
17343
  });
17328
17344
  };
17329
17345
  const getEip155ChainId = (chainId) => `eip155:${chainId}`;
@@ -17908,9 +17924,6 @@ class Passport {
17908
17924
  return this.passportImxProviderFactory.getProvider();
17909
17925
  }
17910
17926
  connectEvm() {
17911
- if (this.config.baseConfig.environment === 'production') {
17912
- throw new Error('EVM is not supported on production network');
17913
- }
17914
17927
  return new ZkEvmProvider({
17915
17928
  passportEventEmitter: this.passportEventEmitter,
17916
17929
  authManager: this.authManager,
@@ -41945,7 +41958,7 @@ const GAS_OVERRIDES = {
41945
41958
  maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
41946
41959
  };
41947
41960
 
41948
- const SDK_VERSION_MARKER = '0.44.0';
41961
+ const SDK_VERSION_MARKER = '0.44.1';
41949
41962
  // This SDK version is replaced by the `yarn build` command ran on the root level
41950
41963
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41951
41964
 
package/dist/index.js CHANGED
@@ -10619,7 +10619,7 @@ class MultiRollupApiClients {
10619
10619
  }
10620
10620
 
10621
10621
  // eslint-disable-next-line @typescript-eslint/naming-convention
10622
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.0' };
10622
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.1' };
10623
10623
  const createConfig = ({ basePath, headers, }) => {
10624
10624
  if (!basePath.trim()) {
10625
10625
  throw Error('basePath can not be empty');
@@ -10691,7 +10691,7 @@ class APIError extends Error {
10691
10691
 
10692
10692
  /* eslint-disable implicit-arrow-linebreak */
10693
10693
  const defaultHeaders = {
10694
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.0',
10694
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.1',
10695
10695
  };
10696
10696
  /**
10697
10697
  * createAPIConfiguration to create a custom Configuration
@@ -11130,7 +11130,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11130
11130
  chainID,
11131
11131
  coreContractAddress,
11132
11132
  registrationContractAddress,
11133
- sdkVersion: 'ts-immutable-sdk-0.44.0',
11133
+ sdkVersion: 'ts-immutable-sdk-0.44.1',
11134
11134
  });
11135
11135
  /**
11136
11136
  * Sets `sdkVersion` at the time of build
@@ -17281,27 +17281,43 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
17281
17281
  const types = { ...typedData.types };
17282
17282
  // @ts-ignore
17283
17283
  delete types.EIP712Domain;
17284
- // eslint-disable-next-line no-underscore-dangle
17285
- const digest = ethers.utils._TypedDataEncoder.hash(typedData.domain, types, typedData.message);
17286
- const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
17287
- const hash = ethers.utils.keccak256(completePayload);
17288
- // Sign the digest
17284
+ // Hash the EIP712 payload and generate the complete payload
17285
+ const { _TypedDataEncoder: typedDataEncoder } = ethers.utils;
17286
+ const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
17287
+ const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
17288
+ const hash = ethers.utils.keccak256(messageSubDigest);
17289
+ // Sign the sub digest
17290
+ // https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
17289
17291
  const hashArray = ethers.utils.arrayify(hash);
17290
17292
  const ethsigNoType = await signer.signMessage(hashArray);
17291
17293
  const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
17292
- const { signers } = decodeRelayerTypedDataSignature(relayerSignature);
17294
+ // Combine the relayer and user signatures; sort by address to match the imageHash order
17295
+ const { signers: relayerSigners } = decodeRelayerTypedDataSignature(relayerSignature);
17296
+ const combinedSigners = [
17297
+ ...relayerSigners,
17298
+ {
17299
+ isDynamic: false,
17300
+ unrecovered: true,
17301
+ weight: SIGNATURE_WEIGHT,
17302
+ signature: signedDigest,
17303
+ address: await signer.getAddress(),
17304
+ },
17305
+ ];
17306
+ const sortedSigners = combinedSigners.sort((a, b) => {
17307
+ const bigA = BigNumber$1.from(a.address);
17308
+ const bigB = BigNumber$1.from(b.address);
17309
+ if (bigA.lte(bigB)) {
17310
+ return -1;
17311
+ }
17312
+ if (bigA.eq(bigB)) {
17313
+ return 0;
17314
+ }
17315
+ return 1;
17316
+ });
17293
17317
  return v1.signature.encodeSignature({
17294
17318
  version: 1,
17295
17319
  threshold: EIP712_SIGNATURE_THRESHOLD,
17296
- signers: [
17297
- ...signers,
17298
- {
17299
- isDynamic: false,
17300
- unrecovered: true,
17301
- weight: SIGNATURE_WEIGHT,
17302
- signature: signedDigest,
17303
- },
17304
- ],
17320
+ signers: sortedSigners,
17305
17321
  });
17306
17322
  };
17307
17323
  const getEip155ChainId = (chainId) => `eip155:${chainId}`;
@@ -17886,9 +17902,6 @@ class Passport {
17886
17902
  return this.passportImxProviderFactory.getProvider();
17887
17903
  }
17888
17904
  connectEvm() {
17889
- if (this.config.baseConfig.environment === 'production') {
17890
- throw new Error('EVM is not supported on production network');
17891
- }
17892
17905
  return new ZkEvmProvider({
17893
17906
  passportEventEmitter: this.passportEventEmitter,
17894
17907
  authManager: this.authManager,
@@ -41923,7 +41936,7 @@ const GAS_OVERRIDES = {
41923
41936
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
41924
41937
  };
41925
41938
 
41926
- const SDK_VERSION_MARKER = '0.44.0';
41939
+ const SDK_VERSION_MARKER = '0.44.1';
41927
41940
  // This SDK version is replaced by the `yarn build` command ran on the root level
41928
41941
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41929
41942
 
package/dist/passport.js CHANGED
@@ -8724,7 +8724,7 @@ class MultiRollupApiClients {
8724
8724
  }
8725
8725
 
8726
8726
  // eslint-disable-next-line @typescript-eslint/naming-convention
8727
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.44.0' };
8727
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.44.1' };
8728
8728
  const createConfig = ({ basePath, headers, }) => {
8729
8729
  if (!basePath.trim()) {
8730
8730
  throw Error('basePath can not be empty');
@@ -8792,7 +8792,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
8792
8792
  chainID,
8793
8793
  coreContractAddress,
8794
8794
  registrationContractAddress,
8795
- sdkVersion: 'ts-immutable-sdk-0.44.0',
8795
+ sdkVersion: 'ts-immutable-sdk-0.44.1',
8796
8796
  });
8797
8797
  /**
8798
8798
  * Sets `sdkVersion` at the time of build
@@ -14926,27 +14926,43 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
14926
14926
  const types = { ...typedData.types };
14927
14927
  // @ts-ignore
14928
14928
  delete types.EIP712Domain;
14929
- // eslint-disable-next-line no-underscore-dangle
14930
- const digest = ethers.utils._TypedDataEncoder.hash(typedData.domain, types, typedData.message);
14931
- const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
14932
- const hash = ethers.utils.keccak256(completePayload);
14933
- // Sign the digest
14929
+ // Hash the EIP712 payload and generate the complete payload
14930
+ const { _TypedDataEncoder: typedDataEncoder } = ethers.utils;
14931
+ const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
14932
+ const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
14933
+ const hash = ethers.utils.keccak256(messageSubDigest);
14934
+ // Sign the sub digest
14935
+ // https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
14934
14936
  const hashArray = ethers.utils.arrayify(hash);
14935
14937
  const ethsigNoType = await signer.signMessage(hashArray);
14936
14938
  const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
14937
- const { signers } = decodeRelayerTypedDataSignature(relayerSignature);
14939
+ // Combine the relayer and user signatures; sort by address to match the imageHash order
14940
+ const { signers: relayerSigners } = decodeRelayerTypedDataSignature(relayerSignature);
14941
+ const combinedSigners = [
14942
+ ...relayerSigners,
14943
+ {
14944
+ isDynamic: false,
14945
+ unrecovered: true,
14946
+ weight: SIGNATURE_WEIGHT,
14947
+ signature: signedDigest,
14948
+ address: await signer.getAddress(),
14949
+ },
14950
+ ];
14951
+ const sortedSigners = combinedSigners.sort((a, b) => {
14952
+ const bigA = BigNumber.from(a.address);
14953
+ const bigB = BigNumber.from(b.address);
14954
+ if (bigA.lte(bigB)) {
14955
+ return -1;
14956
+ }
14957
+ if (bigA.eq(bigB)) {
14958
+ return 0;
14959
+ }
14960
+ return 1;
14961
+ });
14938
14962
  return v1.signature.encodeSignature({
14939
14963
  version: 1,
14940
14964
  threshold: EIP712_SIGNATURE_THRESHOLD,
14941
- signers: [
14942
- ...signers,
14943
- {
14944
- isDynamic: false,
14945
- unrecovered: true,
14946
- weight: SIGNATURE_WEIGHT,
14947
- signature: signedDigest,
14948
- },
14949
- ],
14965
+ signers: sortedSigners,
14950
14966
  });
14951
14967
  };
14952
14968
  const getEip155ChainId = (chainId) => `eip155:${chainId}`;
@@ -15531,9 +15547,6 @@ class Passport {
15531
15547
  return this.passportImxProviderFactory.getProvider();
15532
15548
  }
15533
15549
  connectEvm() {
15534
- if (this.config.baseConfig.environment === 'production') {
15535
- throw new Error('EVM is not supported on production network');
15536
- }
15537
15550
  return new ZkEvmProvider({
15538
15551
  passportEventEmitter: this.passportEventEmitter,
15539
15552
  authManager: this.authManager,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.44.0",
4
+ "version": "0.44.1",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",