@imtbl/sdk 1.7.3 → 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.
Files changed (36) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/BridgeWidget-85db50d2.js +1 -0
  3. package/dist/browser/checkout/OnRampWidget-58400404.js +1 -0
  4. package/dist/browser/checkout/SaleWidget-549f0f75.js +2 -0
  5. package/dist/browser/checkout/SpendingCapHero-24fed6d2.js +1 -0
  6. package/dist/browser/checkout/SwapWidget-9eecba27.js +1 -0
  7. package/dist/browser/checkout/TopUpView-26964a9e.js +1 -0
  8. package/dist/browser/checkout/WalletWidget-7e6fed9c.js +1 -0
  9. package/dist/browser/checkout/auto-track-da38e5a8.js +1 -0
  10. package/dist/browser/checkout/balance-310539bb.js +1 -0
  11. package/dist/browser/checkout/index-392bc434.js +1 -0
  12. package/dist/browser/checkout/index-3d847e0c.js +1 -0
  13. package/dist/browser/checkout/index-4e77760b.js +773 -0
  14. package/dist/browser/checkout/index-8184ffea.js +1 -0
  15. package/dist/browser/checkout/index-919a5df1.js +1 -0
  16. package/dist/browser/checkout/index-e6159023.js +1 -0
  17. package/dist/browser/checkout/index-eb42cd09.js +106 -0
  18. package/dist/browser/checkout/index.umd-c2e32802.js +1 -0
  19. package/dist/browser/checkout/is-plan-event-enabled-80f76ce6.js +1 -0
  20. package/dist/browser/checkout/retry-355e44f2.js +1 -0
  21. package/dist/browser/checkout/sdk.js +4 -4
  22. package/dist/browser/checkout/useTransakEvents-c6a83ea5.js +2 -0
  23. package/dist/browser/checkout/widgets-esm.js +1 -0
  24. package/dist/browser/checkout/widgets.js +50 -51
  25. package/dist/checkout.d.ts +3 -1
  26. package/dist/checkout.js +65 -32
  27. package/dist/config.js +1 -1
  28. package/dist/index.browser.js +7 -7
  29. package/dist/index.browser.js.map +1 -1
  30. package/dist/index.cjs +224 -161
  31. package/dist/index.d.ts +3 -1
  32. package/dist/index.js +224 -161
  33. package/dist/orderbook.js +1 -1
  34. package/dist/passport.js +160 -130
  35. package/dist/x.js +2 -2
  36. package/package.json +1 -1
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' };
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';
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',
9541
+ sdkVersion: 'ts-immutable-sdk-1.8.0',
9542
9542
  });
9543
9543
  /**
9544
9544
  * Sets `sdkVersion` at the time of build
@@ -14176,7 +14176,6 @@ const getAuthConfiguration = (config) => {
14176
14176
  end_session_endpoint: endSessionEndpoint,
14177
14177
  },
14178
14178
  mergeClaims: true,
14179
- loadUserInfo: true,
14180
14179
  scope: oidcConfiguration.scope,
14181
14180
  userStore,
14182
14181
  };
@@ -14217,7 +14216,10 @@ class AuthManager {
14217
14216
  this.logoutMode = config.oidcConfiguration.logoutMode || 'redirect';
14218
14217
  }
14219
14218
  static mapOidcUserToDomainModel = (oidcUser) => {
14220
- const passport = oidcUser.profile?.passport;
14219
+ let passport;
14220
+ if (oidcUser.id_token) {
14221
+ passport = jwt_decode(oidcUser.id_token)?.passport;
14222
+ }
14221
14223
  const user = {
14222
14224
  expired: oidcUser.expired,
14223
14225
  idToken: oidcUser.id_token,
@@ -15642,27 +15644,28 @@ class JsonRpcError extends Error {
15642
15644
  }
15643
15645
 
15644
15646
  const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
15645
- async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
15646
- const web3Provider = new Web3Provider(magicProvider);
15647
- const ethSigner = web3Provider.getSigner();
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);
15647
+ async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
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}`);
@@ -15674,32 +15677,6 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
15674
15677
  return user;
15675
15678
  }
15676
15679
 
15677
- const loginZkEvmUser = async ({ authManager, magicAdapter, multiRollupApiClients, jsonRpcProvider, }) => {
15678
- const user = await authManager.getUserOrLogin();
15679
- if (!user.idToken) {
15680
- throw new Error('User is missing idToken');
15681
- }
15682
- const magicProvider = await magicAdapter.login(user.idToken);
15683
- if (!user.zkEvm) {
15684
- // Generate counterfactual address and retrieve updated Auth0 user
15685
- const userZkevm = await registerZkEvmUser({
15686
- authManager,
15687
- magicProvider,
15688
- multiRollupApiClients,
15689
- accessToken: user.accessToken,
15690
- jsonRpcProvider,
15691
- });
15692
- return {
15693
- user: userZkevm,
15694
- magicProvider,
15695
- };
15696
- }
15697
- return {
15698
- user: user,
15699
- magicProvider,
15700
- };
15701
- };
15702
-
15703
15680
  const transactionRejectedCrossSdkBridgeError = 'Transaction requires confirmation but this functionality is not'
15704
15681
  + ' supported in this environment. Please contact Immutable support if you need to enable this feature.';
15705
15682
  const convertBigNumberishToString = (value) => BigNumber.from(value).toString();
@@ -15895,7 +15872,7 @@ const getMetaTransactions = async (metaTransaction, nonce, chainId, walletAddres
15895
15872
  }
15896
15873
  return [metaTransaction, feeMetaTransaction];
15897
15874
  };
15898
- const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
15875
+ const sendTransaction = ({ params, ethSigner, jsonRpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
15899
15876
  .withConfirmationScreen({ width: 480, height: 720 })(async () => {
15900
15877
  const transactionRequest = params[0];
15901
15878
  if (!transactionRequest.to) {
@@ -15903,8 +15880,6 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
15903
15880
  }
15904
15881
  const { chainId } = await jsonRpcProvider.ready;
15905
15882
  const chainIdBigNumber = BigNumber.from(chainId);
15906
- const magicWeb3Provider = new Web3Provider(magicProvider);
15907
- const signer = magicWeb3Provider.getSigner();
15908
15883
  const nonce = await getNonce(jsonRpcProvider, zkevmAddress);
15909
15884
  const metaTransaction = {
15910
15885
  to: transactionRequest.to,
@@ -15913,15 +15888,18 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
15913
15888
  value: transactionRequest.value,
15914
15889
  revertOnError: true,
15915
15890
  };
15916
- const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress, signer, relayerClient);
15917
- await guardianClient.validateEVMTransaction({
15918
- chainId: getEip155ChainId(chainId),
15919
- nonce: convertBigNumberishToString(nonce),
15920
- metaTransactions,
15921
- });
15922
- // NOTE: We sign again because we now are adding the fee transaction, so the
15923
- // whole payload is different and needs a new signature.
15924
- const signedTransactions = await getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, signer);
15891
+ const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress, ethSigner, relayerClient);
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
+ ]);
15925
15903
  const relayerId = await relayerClient.ethSendTransaction(zkevmAddress, signedTransactions);
15926
15904
  const retrieveRelayerTransaction = async () => {
15927
15905
  const tx = await relayerClient.imGetTransactionByHash(relayerId);
@@ -15990,7 +15968,7 @@ const transformTypedData = (typedData, chainId) => {
15990
15968
  }
15991
15969
  return transformedTypedData;
15992
15970
  };
15993
- const signTypedDataV4 = async ({ params, method, magicProvider, jsonRpcProvider, relayerClient, guardianClient, }) => guardianClient
15971
+ const signTypedDataV4 = async ({ params, method, ethSigner, jsonRpcProvider, relayerClient, guardianClient, }) => guardianClient
15994
15972
  .withConfirmationScreen({ width: 480, height: 720 })(async () => {
15995
15973
  const fromAddress = params[0];
15996
15974
  const typedDataParam = params[1];
@@ -16001,106 +15979,158 @@ const signTypedDataV4 = async ({ params, method, magicProvider, jsonRpcProvider,
16001
15979
  const typedData = transformTypedData(typedDataParam, chainId);
16002
15980
  await guardianClient.validateMessage({ chainID: String(chainId), payload: typedData });
16003
15981
  const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
16004
- const magicWeb3Provider = new Web3Provider(magicProvider);
16005
- const signer = magicWeb3Provider.getSigner();
16006
- return getSignedTypedData(typedData, relayerSignature, BigNumber.from(chainId), fromAddress, signer);
15982
+ return getSignedTypedData(typedData, relayerSignature, BigNumber.from(chainId), fromAddress, ethSigner);
16007
15983
  });
16008
15984
 
15985
+ const isZkEvmUser = (user) => 'zkEvm' in user;
16009
15986
  class ZkEvmProvider {
16010
- authManager;
16011
- config;
16012
- magicAdapter;
16013
- multiRollupApiClients;
16014
- jsonRpcProvider; // Used for read
16015
- eventEmitter;
16016
- guardianClient;
16017
- relayerClient;
16018
- magicProvider; // Used for signing
16019
- zkevmAddress;
15987
+ #authManager;
15988
+ #config;
15989
+ #eventEmitter;
15990
+ #guardianClient;
15991
+ #jsonRpcProvider; // Used for read
15992
+ #magicAdapter;
15993
+ #multiRollupApiClients;
15994
+ #relayerClient;
15995
+ /**
15996
+ * This property is set during `#initialiseEthSigner` and stores the signer in a promise.
15997
+ * This property is not meant to be accessed directly, but through the
15998
+ * `#getSigner` method.
15999
+ * @see getSigner
16000
+ */
16001
+ #ethSigner;
16002
+ #signerInitialisationError;
16003
+ #zkEvmAddress;
16020
16004
  isPassport = true;
16021
16005
  constructor({ authManager, magicAdapter, config, multiRollupApiClients, passportEventEmitter, guardianClient, }) {
16022
- this.authManager = authManager;
16023
- this.magicAdapter = magicAdapter;
16024
- this.config = config;
16025
- this.guardianClient = guardianClient;
16006
+ this.#authManager = authManager;
16007
+ this.#magicAdapter = magicAdapter;
16008
+ this.#config = config;
16009
+ this.#guardianClient = guardianClient;
16026
16010
  if (config.crossSdkBridgeEnabled) {
16027
16011
  // JsonRpcProvider by default sets the referrer as "client".
16028
16012
  // On Unreal 4 this errors as the browser used is expecting a valid URL.
16029
- this.jsonRpcProvider = new JsonRpcProvider({
16030
- url: this.config.zkEvmRpcUrl,
16013
+ this.#jsonRpcProvider = new JsonRpcProvider({
16014
+ url: this.#config.zkEvmRpcUrl,
16031
16015
  fetchOptions: { referrer: 'http://imtblgamesdk.local' },
16032
16016
  });
16033
16017
  }
16034
16018
  else {
16035
- this.jsonRpcProvider = new JsonRpcProvider(this.config.zkEvmRpcUrl);
16019
+ this.#jsonRpcProvider = new JsonRpcProvider(this.#config.zkEvmRpcUrl);
16036
16020
  }
16037
- this.multiRollupApiClients = multiRollupApiClients;
16038
- this.eventEmitter = new TypedEventEmitter();
16039
- passportEventEmitter.on(PassportEvents.LOGGED_OUT, this.handleLogout);
16040
- }
16041
- handleLogout = () => {
16042
- const shouldEmitAccountsChanged = this.isLoggedIn();
16043
- this.magicProvider = undefined;
16044
- this.relayerClient = undefined;
16021
+ this.#relayerClient = new RelayerClient({
16022
+ config: this.#config,
16023
+ jsonRpcProvider: this.#jsonRpcProvider,
16024
+ authManager: this.#authManager,
16025
+ });
16026
+ this.#multiRollupApiClients = multiRollupApiClients;
16027
+ this.#eventEmitter = new TypedEventEmitter();
16028
+ passportEventEmitter.on(PassportEvents.LOGGED_OUT, this.#handleLogout);
16029
+ }
16030
+ #handleLogout = () => {
16031
+ const shouldEmitAccountsChanged = !!this.#zkEvmAddress;
16032
+ this.#ethSigner = undefined;
16033
+ this.#zkEvmAddress = undefined;
16045
16034
  if (shouldEmitAccountsChanged) {
16046
- this.eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, []);
16035
+ this.#eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, []);
16047
16036
  }
16048
16037
  };
16049
- isLoggedIn() {
16050
- return this.magicProvider !== undefined
16051
- && this.zkevmAddress !== undefined
16052
- && this.relayerClient !== undefined;
16038
+ /**
16039
+ * This method is called by `eth_requestAccounts` and asynchronously initialises the signer.
16040
+ * The signer is stored in a promise so that it can be retrieved by the provider
16041
+ * when needed.
16042
+ *
16043
+ * If an error is thrown during initialisation, it is stored in the `signerInitialisationError`,
16044
+ * so that it doesn't result in an unhandled promise rejection.
16045
+ *
16046
+ * This error is thrown when the signer is requested through:
16047
+ * @see #getSigner
16048
+ *
16049
+ */
16050
+ async #initialiseEthSigner(user) {
16051
+ const generateSigner = async () => {
16052
+ const magicRpcProvider = await this.#magicAdapter.login(user.idToken);
16053
+ const web3Provider = new Web3Provider(magicRpcProvider);
16054
+ return web3Provider.getSigner();
16055
+ };
16056
+ // eslint-disable-next-line no-async-promise-executor
16057
+ this.#ethSigner = new Promise(async (resolve) => {
16058
+ try {
16059
+ resolve(await generateSigner());
16060
+ }
16061
+ catch (err) {
16062
+ // Capture and store the initialization error
16063
+ this.#signerInitialisationError = err;
16064
+ resolve(undefined);
16065
+ }
16066
+ });
16053
16067
  }
16054
- async performRequest(request) {
16068
+ async #getSigner() {
16069
+ const ethSigner = await this.#ethSigner;
16070
+ // Throw the stored error if the signers failed to initialise
16071
+ if (typeof ethSigner === 'undefined') {
16072
+ if (typeof this.#signerInitialisationError !== 'undefined') {
16073
+ throw this.#signerInitialisationError;
16074
+ }
16075
+ throw new Error('Signer failed to initialise');
16076
+ }
16077
+ return ethSigner;
16078
+ }
16079
+ async #performRequest(request) {
16055
16080
  switch (request.method) {
16056
16081
  case 'eth_requestAccounts': {
16057
- if (this.isLoggedIn()) {
16058
- return [this.zkevmAddress];
16082
+ if (this.#zkEvmAddress) {
16083
+ return [this.#zkEvmAddress];
16059
16084
  }
16060
- const { magicProvider, user } = await loginZkEvmUser({
16061
- authManager: this.authManager,
16062
- magicAdapter: this.magicAdapter,
16063
- multiRollupApiClients: this.multiRollupApiClients,
16064
- jsonRpcProvider: this.jsonRpcProvider,
16065
- });
16066
- this.magicProvider = magicProvider;
16067
- this.relayerClient = new RelayerClient({
16068
- config: this.config,
16069
- jsonRpcProvider: this.jsonRpcProvider,
16070
- authManager: this.authManager,
16071
- });
16072
- this.zkevmAddress = user.zkEvm.ethAddress;
16073
- this.eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, [user.zkEvm.ethAddress]);
16074
- return [user.zkEvm.ethAddress];
16085
+ const user = await this.#authManager.getUserOrLogin();
16086
+ this.#initialiseEthSigner(user);
16087
+ if (!isZkEvmUser(user)) {
16088
+ const ethSigner = await this.#getSigner();
16089
+ const userZkEvm = await registerZkEvmUser({
16090
+ ethSigner,
16091
+ authManager: this.#authManager,
16092
+ multiRollupApiClients: this.#multiRollupApiClients,
16093
+ accessToken: user.accessToken,
16094
+ jsonRpcProvider: this.#jsonRpcProvider,
16095
+ });
16096
+ this.#zkEvmAddress = userZkEvm.zkEvm.ethAddress;
16097
+ }
16098
+ else {
16099
+ this.#zkEvmAddress = user.zkEvm.ethAddress;
16100
+ }
16101
+ this.#eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, [this.#zkEvmAddress]);
16102
+ return [this.#zkEvmAddress];
16075
16103
  }
16076
16104
  case 'eth_sendTransaction': {
16077
- if (!this.isLoggedIn()) {
16105
+ if (!this.#zkEvmAddress) {
16078
16106
  throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
16079
16107
  }
16108
+ const ethSigner = await this.#getSigner();
16080
16109
  return sendTransaction({
16081
16110
  params: request.params || [],
16082
- magicProvider: this.magicProvider,
16083
- guardianClient: this.guardianClient,
16084
- jsonRpcProvider: this.jsonRpcProvider,
16085
- relayerClient: this.relayerClient,
16086
- zkevmAddress: this.zkevmAddress,
16111
+ ethSigner,
16112
+ guardianClient: this.#guardianClient,
16113
+ jsonRpcProvider: this.#jsonRpcProvider,
16114
+ relayerClient: this.#relayerClient,
16115
+ zkevmAddress: this.#zkEvmAddress,
16087
16116
  });
16088
16117
  }
16089
16118
  case 'eth_accounts': {
16090
- return this.zkevmAddress ? [this.zkevmAddress] : [];
16119
+ return this.#zkEvmAddress ? [this.#zkEvmAddress] : [];
16091
16120
  }
16092
16121
  case 'eth_signTypedData':
16093
16122
  case 'eth_signTypedData_v4': {
16094
- if (!this.isLoggedIn()) {
16123
+ if (!this.#zkEvmAddress) {
16095
16124
  throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
16096
16125
  }
16126
+ const ethSigner = await this.#getSigner();
16097
16127
  return signTypedDataV4({
16098
16128
  method: request.method,
16099
16129
  params: request.params || [],
16100
- magicProvider: this.magicProvider,
16101
- jsonRpcProvider: this.jsonRpcProvider,
16102
- relayerClient: this.relayerClient,
16103
- guardianClient: this.guardianClient,
16130
+ ethSigner,
16131
+ jsonRpcProvider: this.#jsonRpcProvider,
16132
+ relayerClient: this.#relayerClient,
16133
+ guardianClient: this.#guardianClient,
16104
16134
  });
16105
16135
  }
16106
16136
  // Pass through methods
@@ -16117,17 +16147,17 @@ class ZkEvmProvider {
16117
16147
  case 'eth_getTransactionByHash':
16118
16148
  case 'eth_getTransactionReceipt':
16119
16149
  case 'eth_getTransactionCount': {
16120
- return this.jsonRpcProvider.send(request.method, request.params || []);
16150
+ return this.#jsonRpcProvider.send(request.method, request.params || []);
16121
16151
  }
16122
16152
  default: {
16123
16153
  throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
16124
16154
  }
16125
16155
  }
16126
16156
  }
16127
- async performJsonRpcRequest(request) {
16157
+ async #performJsonRpcRequest(request) {
16128
16158
  const { id, jsonrpc } = request;
16129
16159
  try {
16130
- const result = await this.performRequest(request);
16160
+ const result = await this.#performRequest(request);
16131
16161
  return {
16132
16162
  id,
16133
16163
  jsonrpc,
@@ -16154,7 +16184,7 @@ class ZkEvmProvider {
16154
16184
  }
16155
16185
  async request(request) {
16156
16186
  try {
16157
- return this.performRequest(request);
16187
+ return this.#performRequest(request);
16158
16188
  }
16159
16189
  catch (error) {
16160
16190
  if (error instanceof JsonRpcError) {
@@ -16171,14 +16201,14 @@ class ZkEvmProvider {
16171
16201
  throw new Error('No callback provided');
16172
16202
  }
16173
16203
  if (Array.isArray(request)) {
16174
- Promise.all(request.map(this.performJsonRpcRequest)).then((result) => {
16204
+ Promise.all(request.map(this.#performJsonRpcRequest)).then((result) => {
16175
16205
  callback(null, result);
16176
16206
  }).catch((error) => {
16177
16207
  callback(error, []);
16178
16208
  });
16179
16209
  }
16180
16210
  else {
16181
- this.performJsonRpcRequest(request).then((result) => {
16211
+ this.#performJsonRpcRequest(request).then((result) => {
16182
16212
  callback(null, result);
16183
16213
  }).catch((error) => {
16184
16214
  callback(error, null);
@@ -16210,15 +16240,15 @@ class ZkEvmProvider {
16210
16240
  return this.sendAsync(request, callbackOrParams);
16211
16241
  }
16212
16242
  if (!Array.isArray(request) && typeof request === 'object') {
16213
- return this.performJsonRpcRequest(request);
16243
+ return this.#performJsonRpcRequest(request);
16214
16244
  }
16215
16245
  throw new JsonRpcError(RpcErrorCode.INVALID_REQUEST, 'Invalid request');
16216
16246
  }
16217
16247
  on(event, listener) {
16218
- this.eventEmitter.on(event, listener);
16248
+ this.#eventEmitter.on(event, listener);
16219
16249
  }
16220
16250
  removeListener(event, listener) {
16221
- this.eventEmitter.removeListener(event, listener);
16251
+ this.#eventEmitter.removeListener(event, listener);
16222
16252
  }
16223
16253
  }
16224
16254
 
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';
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',
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",
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",