@imtbl/sdk 1.7.3-alpha.2 → 1.8.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/index.cjs CHANGED
@@ -174,7 +174,7 @@ const flattenProperties$1 = (properties) => {
174
174
  };
175
175
 
176
176
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
177
- const SDK_VERSION$1 = '1.7.3-alpha.2';
177
+ const SDK_VERSION$1 = '1.8.0';
178
178
  const getReferrer$1 = () => {
179
179
  if (isNode$1()) {
180
180
  return '';
@@ -11298,7 +11298,7 @@ class MultiRollupApiClients {
11298
11298
  }
11299
11299
 
11300
11300
  // eslint-disable-next-line @typescript-eslint/naming-convention
11301
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.7.3-alpha.2' };
11301
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.8.0' };
11302
11302
  const createConfig = ({ basePath, headers, }) => {
11303
11303
  if (!basePath.trim()) {
11304
11304
  throw Error('basePath can not be empty');
@@ -11370,7 +11370,7 @@ class APIError extends Error {
11370
11370
 
11371
11371
  /* eslint-disable implicit-arrow-linebreak */
11372
11372
  const defaultHeaders = {
11373
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.7.3-alpha.2',
11373
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.8.0',
11374
11374
  };
11375
11375
  /**
11376
11376
  * createAPIConfiguration to create a custom Configuration
@@ -11803,7 +11803,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11803
11803
  chainID,
11804
11804
  coreContractAddress,
11805
11805
  registrationContractAddress,
11806
- sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.2',
11806
+ sdkVersion: 'ts-immutable-sdk-1.8.0',
11807
11807
  });
11808
11808
  /**
11809
11809
  * Sets `sdkVersion` at the time of build
@@ -17919,24 +17919,27 @@ class JsonRpcError extends Error {
17919
17919
 
17920
17920
  const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
17921
17921
  async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
17922
- const ethereumAddress = await ethSigner.getAddress();
17923
- const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
17924
- const headers = { Authorization: `Bearer ${accessToken}` };
17925
- const { chainId } = await jsonRpcProvider.ready;
17926
- const eipChainId = getEip155ChainId(chainId);
17922
+ const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
17923
+ ethSigner.getAddress(),
17924
+ signRaw(MESSAGE_TO_SIGN, ethSigner),
17925
+ jsonRpcProvider.ready,
17926
+ multiRollupApiClients.chainsApi.listChains(),
17927
+ ]);
17928
+ const eipChainId = getEip155ChainId(network.chainId);
17929
+ const chainName = chainListResponse.data?.result?.find((chain) => chain.id === eipChainId)?.name;
17930
+ if (!chainName) {
17931
+ throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${network.chainId}`);
17932
+ }
17927
17933
  try {
17928
- const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
17929
- const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
17930
- if (!chainName) {
17931
- throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
17932
- }
17933
17934
  await multiRollupApiClients.passportApi.createCounterfactualAddressV2({
17934
17935
  chainName,
17935
17936
  createCounterfactualAddressRequest: {
17936
17937
  ethereum_address: ethereumAddress,
17937
17938
  ethereum_signature: ethereumSignature,
17938
17939
  },
17939
- }, { headers });
17940
+ }, {
17941
+ headers: { Authorization: `Bearer ${accessToken}` },
17942
+ });
17940
17943
  }
17941
17944
  catch (error) {
17942
17945
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Failed to create counterfactual address: ${error}`);
@@ -18160,14 +18163,17 @@ const sendTransaction$1 = ({ params, ethSigner, jsonRpcProvider, relayerClient,
18160
18163
  revertOnError: true,
18161
18164
  };
18162
18165
  const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress, ethSigner, relayerClient);
18163
- await guardianClient.validateEVMTransaction({
18164
- chainId: getEip155ChainId(chainId),
18165
- nonce: convertBigNumberishToString(nonce),
18166
- metaTransactions,
18167
- });
18168
- // NOTE: We sign again because we now are adding the fee transaction, so the
18169
- // whole payload is different and needs a new signature.
18170
- const signedTransactions = await getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
18166
+ // Parallelize the validation and signing of the transaction
18167
+ const [, signedTransactions] = await Promise.all([
18168
+ guardianClient.validateEVMTransaction({
18169
+ chainId: getEip155ChainId(chainId),
18170
+ nonce: convertBigNumberishToString(nonce),
18171
+ metaTransactions,
18172
+ }),
18173
+ // NOTE: We sign again because we now are adding the fee transaction, so the
18174
+ // whole payload is different and needs a new signature.
18175
+ getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner),
18176
+ ]);
18171
18177
  const relayerId = await relayerClient.ethSendTransaction(zkevmAddress, signedTransactions);
18172
18178
  const retrieveRelayerTransaction = async () => {
18173
18179
  const tx = await relayerClient.imGetTransactionByHash(relayerId);
@@ -37478,7 +37484,7 @@ const flattenProperties = (properties) => {
37478
37484
  };
37479
37485
 
37480
37486
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
37481
- const SDK_VERSION = '1.7.3-alpha.2';
37487
+ const SDK_VERSION = '1.8.0';
37482
37488
  const getReferrer = () => {
37483
37489
  if (isNode()) {
37484
37490
  return '';
@@ -42646,7 +42652,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
42646
42652
  maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
42647
42653
  };
42648
42654
 
42649
- const SDK_VERSION_MARKER = '1.7.3-alpha.2';
42655
+ const SDK_VERSION_MARKER = '1.8.0';
42650
42656
  // This SDK version is replaced by the `yarn build` command ran on the root level
42651
42657
  const globalPackageVersion = () => SDK_VERSION_MARKER;
42652
42658
 
package/dist/index.js CHANGED
@@ -152,7 +152,7 @@ const flattenProperties$1 = (properties) => {
152
152
  };
153
153
 
154
154
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
155
- const SDK_VERSION$1 = '1.7.3-alpha.2';
155
+ const SDK_VERSION$1 = '1.8.0';
156
156
  const getReferrer$1 = () => {
157
157
  if (isNode$1()) {
158
158
  return '';
@@ -11276,7 +11276,7 @@ class MultiRollupApiClients {
11276
11276
  }
11277
11277
 
11278
11278
  // eslint-disable-next-line @typescript-eslint/naming-convention
11279
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.7.3-alpha.2' };
11279
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.8.0' };
11280
11280
  const createConfig = ({ basePath, headers, }) => {
11281
11281
  if (!basePath.trim()) {
11282
11282
  throw Error('basePath can not be empty');
@@ -11348,7 +11348,7 @@ class APIError extends Error {
11348
11348
 
11349
11349
  /* eslint-disable implicit-arrow-linebreak */
11350
11350
  const defaultHeaders = {
11351
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.7.3-alpha.2',
11351
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.8.0',
11352
11352
  };
11353
11353
  /**
11354
11354
  * createAPIConfiguration to create a custom Configuration
@@ -11781,7 +11781,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11781
11781
  chainID,
11782
11782
  coreContractAddress,
11783
11783
  registrationContractAddress,
11784
- sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.2',
11784
+ sdkVersion: 'ts-immutable-sdk-1.8.0',
11785
11785
  });
11786
11786
  /**
11787
11787
  * Sets `sdkVersion` at the time of build
@@ -17897,24 +17897,27 @@ class JsonRpcError extends Error {
17897
17897
 
17898
17898
  const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
17899
17899
  async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
17900
- const ethereumAddress = await ethSigner.getAddress();
17901
- const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
17902
- const headers = { Authorization: `Bearer ${accessToken}` };
17903
- const { chainId } = await jsonRpcProvider.ready;
17904
- const eipChainId = getEip155ChainId(chainId);
17900
+ const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
17901
+ ethSigner.getAddress(),
17902
+ signRaw(MESSAGE_TO_SIGN, ethSigner),
17903
+ jsonRpcProvider.ready,
17904
+ multiRollupApiClients.chainsApi.listChains(),
17905
+ ]);
17906
+ const eipChainId = getEip155ChainId(network.chainId);
17907
+ const chainName = chainListResponse.data?.result?.find((chain) => chain.id === eipChainId)?.name;
17908
+ if (!chainName) {
17909
+ throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${network.chainId}`);
17910
+ }
17905
17911
  try {
17906
- const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
17907
- const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
17908
- if (!chainName) {
17909
- throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
17910
- }
17911
17912
  await multiRollupApiClients.passportApi.createCounterfactualAddressV2({
17912
17913
  chainName,
17913
17914
  createCounterfactualAddressRequest: {
17914
17915
  ethereum_address: ethereumAddress,
17915
17916
  ethereum_signature: ethereumSignature,
17916
17917
  },
17917
- }, { headers });
17918
+ }, {
17919
+ headers: { Authorization: `Bearer ${accessToken}` },
17920
+ });
17918
17921
  }
17919
17922
  catch (error) {
17920
17923
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Failed to create counterfactual address: ${error}`);
@@ -18138,14 +18141,17 @@ const sendTransaction$1 = ({ params, ethSigner, jsonRpcProvider, relayerClient,
18138
18141
  revertOnError: true,
18139
18142
  };
18140
18143
  const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress, ethSigner, relayerClient);
18141
- await guardianClient.validateEVMTransaction({
18142
- chainId: getEip155ChainId(chainId),
18143
- nonce: convertBigNumberishToString(nonce),
18144
- metaTransactions,
18145
- });
18146
- // NOTE: We sign again because we now are adding the fee transaction, so the
18147
- // whole payload is different and needs a new signature.
18148
- const signedTransactions = await getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
18144
+ // Parallelize the validation and signing of the transaction
18145
+ const [, signedTransactions] = await Promise.all([
18146
+ guardianClient.validateEVMTransaction({
18147
+ chainId: getEip155ChainId(chainId),
18148
+ nonce: convertBigNumberishToString(nonce),
18149
+ metaTransactions,
18150
+ }),
18151
+ // NOTE: We sign again because we now are adding the fee transaction, so the
18152
+ // whole payload is different and needs a new signature.
18153
+ getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner),
18154
+ ]);
18149
18155
  const relayerId = await relayerClient.ethSendTransaction(zkevmAddress, signedTransactions);
18150
18156
  const retrieveRelayerTransaction = async () => {
18151
18157
  const tx = await relayerClient.imGetTransactionByHash(relayerId);
@@ -37456,7 +37462,7 @@ const flattenProperties = (properties) => {
37456
37462
  };
37457
37463
 
37458
37464
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
37459
- const SDK_VERSION = '1.7.3-alpha.2';
37465
+ const SDK_VERSION = '1.8.0';
37460
37466
  const getReferrer = () => {
37461
37467
  if (isNode()) {
37462
37468
  return '';
@@ -42624,7 +42630,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
42624
42630
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
42625
42631
  };
42626
42632
 
42627
- const SDK_VERSION_MARKER = '1.7.3-alpha.2';
42633
+ const SDK_VERSION_MARKER = '1.8.0';
42628
42634
  // This SDK version is replaced by the `yarn build` command ran on the root level
42629
42635
  const globalPackageVersion = () => SDK_VERSION_MARKER;
42630
42636
 
package/dist/orderbook.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.7.3-alpha.2';
134
+ const SDK_VERSION = '1.8.0';
135
135
  const getReferrer = () => {
136
136
  if (isNode()) {
137
137
  return '';
package/dist/passport.js CHANGED
@@ -9146,7 +9146,7 @@ class MultiRollupApiClients {
9146
9146
  }
9147
9147
 
9148
9148
  // eslint-disable-next-line @typescript-eslint/naming-convention
9149
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.7.3-alpha.2' };
9149
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.8.0' };
9150
9150
  const createConfig = ({ basePath, headers, }) => {
9151
9151
  if (!basePath.trim()) {
9152
9152
  throw Error('basePath can not be empty');
@@ -9325,7 +9325,7 @@ const flattenProperties = (properties) => {
9325
9325
  };
9326
9326
 
9327
9327
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
9328
- const SDK_VERSION = '1.7.3-alpha.2';
9328
+ const SDK_VERSION = '1.8.0';
9329
9329
  const getReferrer = () => {
9330
9330
  if (isNode()) {
9331
9331
  return '';
@@ -9538,7 +9538,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
9538
9538
  chainID,
9539
9539
  coreContractAddress,
9540
9540
  registrationContractAddress,
9541
- sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.2',
9541
+ sdkVersion: 'ts-immutable-sdk-1.8.0',
9542
9542
  });
9543
9543
  /**
9544
9544
  * Sets `sdkVersion` at the time of build
@@ -15645,24 +15645,27 @@ class JsonRpcError extends Error {
15645
15645
 
15646
15646
  const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
15647
15647
  async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
15648
- const ethereumAddress = await ethSigner.getAddress();
15649
- const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
15650
- const headers = { Authorization: `Bearer ${accessToken}` };
15651
- const { chainId } = await jsonRpcProvider.ready;
15652
- const eipChainId = getEip155ChainId(chainId);
15648
+ const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
15649
+ ethSigner.getAddress(),
15650
+ signRaw(MESSAGE_TO_SIGN, ethSigner),
15651
+ jsonRpcProvider.ready,
15652
+ multiRollupApiClients.chainsApi.listChains(),
15653
+ ]);
15654
+ const eipChainId = getEip155ChainId(network.chainId);
15655
+ const chainName = chainListResponse.data?.result?.find((chain) => chain.id === eipChainId)?.name;
15656
+ if (!chainName) {
15657
+ throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${network.chainId}`);
15658
+ }
15653
15659
  try {
15654
- const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
15655
- const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
15656
- if (!chainName) {
15657
- throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
15658
- }
15659
15660
  await multiRollupApiClients.passportApi.createCounterfactualAddressV2({
15660
15661
  chainName,
15661
15662
  createCounterfactualAddressRequest: {
15662
15663
  ethereum_address: ethereumAddress,
15663
15664
  ethereum_signature: ethereumSignature,
15664
15665
  },
15665
- }, { headers });
15666
+ }, {
15667
+ headers: { Authorization: `Bearer ${accessToken}` },
15668
+ });
15666
15669
  }
15667
15670
  catch (error) {
15668
15671
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Failed to create counterfactual address: ${error}`);
@@ -15886,14 +15889,17 @@ const sendTransaction = ({ params, ethSigner, jsonRpcProvider, relayerClient, gu
15886
15889
  revertOnError: true,
15887
15890
  };
15888
15891
  const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress, ethSigner, relayerClient);
15889
- await guardianClient.validateEVMTransaction({
15890
- chainId: getEip155ChainId(chainId),
15891
- nonce: convertBigNumberishToString(nonce),
15892
- metaTransactions,
15893
- });
15894
- // NOTE: We sign again because we now are adding the fee transaction, so the
15895
- // whole payload is different and needs a new signature.
15896
- const signedTransactions = await getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
15892
+ // Parallelize the validation and signing of the transaction
15893
+ const [, signedTransactions] = await Promise.all([
15894
+ guardianClient.validateEVMTransaction({
15895
+ chainId: getEip155ChainId(chainId),
15896
+ nonce: convertBigNumberishToString(nonce),
15897
+ metaTransactions,
15898
+ }),
15899
+ // NOTE: We sign again because we now are adding the fee transaction, so the
15900
+ // whole payload is different and needs a new signature.
15901
+ getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner),
15902
+ ]);
15897
15903
  const relayerId = await relayerClient.ethSendTransaction(zkevmAddress, signedTransactions);
15898
15904
  const retrieveRelayerTransaction = async () => {
15899
15905
  const tx = await relayerClient.imGetTransactionByHash(relayerId);
package/dist/x.js CHANGED
@@ -136,7 +136,7 @@ const flattenProperties = (properties) => {
136
136
  };
137
137
 
138
138
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
139
- const SDK_VERSION = '1.7.3-alpha.2';
139
+ const SDK_VERSION = '1.8.0';
140
140
  const getReferrer = () => {
141
141
  if (isNode()) {
142
142
  return '';
@@ -328,7 +328,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
328
328
  chainID,
329
329
  coreContractAddress,
330
330
  registrationContractAddress,
331
- sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.2',
331
+ sdkVersion: 'ts-immutable-sdk-1.8.0',
332
332
  });
333
333
  /**
334
334
  * 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.7.3-alpha.2",
4
+ "version": "1.8.0",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",