@imtbl/sdk 1.41.3 → 1.42.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
@@ -185,7 +185,7 @@ const flattenProperties$1 = (properties) => {
185
185
  };
186
186
 
187
187
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
188
- const SDK_VERSION$1 = '1.41.3';
188
+ const SDK_VERSION$1 = '1.42.0';
189
189
  const getFrameParentDomain$1 = () => {
190
190
  if (isNode$1()) {
191
191
  return '';
@@ -14212,7 +14212,7 @@ class MultiRollupApiClients {
14212
14212
  }
14213
14213
 
14214
14214
  // eslint-disable-next-line @typescript-eslint/naming-convention
14215
- const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.41.3' };
14215
+ const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.42.0' };
14216
14216
  const createConfig$1 = ({ basePath, headers, }) => {
14217
14217
  if (!basePath.trim()) {
14218
14218
  throw Error('basePath can not be empty');
@@ -14284,7 +14284,7 @@ class APIError extends Error {
14284
14284
 
14285
14285
  /* eslint-disable implicit-arrow-linebreak */
14286
14286
  const defaultHeaders$1 = {
14287
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.41.3',
14287
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.42.0',
14288
14288
  };
14289
14289
  /**
14290
14290
  * createAPIConfiguration to create a custom Configuration
@@ -14758,7 +14758,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
14758
14758
  /* eslint-disable @typescript-eslint/naming-convention */
14759
14759
  class ApiConfiguration extends index$2.Configuration {
14760
14760
  }
14761
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.41.3' };
14761
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.42.0' };
14762
14762
  /**
14763
14763
  * @dev use createImmutableXConfiguration instead
14764
14764
  */
@@ -14799,7 +14799,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
14799
14799
  coreContractAddress,
14800
14800
  registrationContractAddress,
14801
14801
  registrationV4ContractAddress,
14802
- sdkVersion: 'ts-immutable-sdk-1.41.3',
14802
+ sdkVersion: 'ts-immutable-sdk-1.42.0',
14803
14803
  baseConfig,
14804
14804
  });
14805
14805
  const production = ({ baseConfig }) => createImmutableXConfiguration({
@@ -26809,9 +26809,7 @@ var globalAxios = axios$2;
26809
26809
  * https://openapi-generator.tech
26810
26810
  * Do not edit the class manually.
26811
26811
  */
26812
- // Some imports not used depending on template conditions
26813
- // @ts-ignore
26814
- const BASE_PATH = "https://guardian.sandbox.imtbl.com".replace(/\/+$/, "");
26812
+ const BASE_PATH = "https://api.immutable.com".replace(/\/+$/, "");
26815
26813
  /**
26816
26814
  *
26817
26815
  * @export
@@ -26826,7 +26824,7 @@ class BaseAPI {
26826
26824
  this.axios = axios;
26827
26825
  if (configuration) {
26828
26826
  this.configuration = configuration;
26829
- this.basePath = configuration.basePath || this.basePath;
26827
+ this.basePath = configuration.basePath ?? basePath;
26830
26828
  }
26831
26829
  }
26832
26830
  }
@@ -26838,12 +26836,17 @@ class BaseAPI {
26838
26836
  */
26839
26837
  class RequiredError extends Error {
26840
26838
  field;
26841
- name = "RequiredError";
26842
26839
  constructor(field, msg) {
26843
26840
  super(msg);
26844
26841
  this.field = field;
26842
+ this.name = "RequiredError";
26845
26843
  }
26846
26844
  }
26845
+ /**
26846
+ *
26847
+ * @export
26848
+ */
26849
+ const operationServerMap = {};
26847
26850
 
26848
26851
  /* tslint:disable */
26849
26852
  /* eslint-disable */
@@ -26886,6 +26889,8 @@ const setBearerAuthToObject = async function (object, configuration) {
26886
26889
  }
26887
26890
  };
26888
26891
  function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
26892
+ if (parameter == null)
26893
+ return;
26889
26894
  if (typeof parameter === "object") {
26890
26895
  if (Array.isArray(parameter)) {
26891
26896
  parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
@@ -26938,7 +26943,7 @@ const toPathString = function (url) {
26938
26943
  */
26939
26944
  const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
26940
26945
  return (axios = globalAxios, basePath = BASE_PATH) => {
26941
- const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
26946
+ const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
26942
26947
  return axios.request(axiosRequestArgs);
26943
26948
  };
26944
26949
  };
@@ -26962,6 +26967,38 @@ const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, confi
26962
26967
  */
26963
26968
  const MessagesApiAxiosParamCreator = function (configuration) {
26964
26969
  return {
26970
+ /**
26971
+ * Approve a pending erc191 message
26972
+ * @summary Approve a pending erc191 message
26973
+ * @param {string} messageID id for the message
26974
+ * @param {*} [options] Override http request option.
26975
+ * @throws {RequiredError}
26976
+ */
26977
+ approvePendingERC191Message: async (messageID, options = {}) => {
26978
+ // verify required parameter 'messageID' is not null or undefined
26979
+ assertParamExists('approvePendingERC191Message', 'messageID', messageID);
26980
+ const localVarPath = `/guardian/v1/erc191-messages/{messageID}/approve`
26981
+ .replace(`{${"messageID"}}`, encodeURIComponent(String(messageID)));
26982
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
26983
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
26984
+ let baseOptions;
26985
+ if (configuration) {
26986
+ baseOptions = configuration.baseOptions;
26987
+ }
26988
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
26989
+ const localVarHeaderParameter = {};
26990
+ const localVarQueryParameter = {};
26991
+ // authentication BearerAuth required
26992
+ // http bearer authentication required
26993
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
26994
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
26995
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
26996
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
26997
+ return {
26998
+ url: toPathString(localVarUrlObj),
26999
+ options: localVarRequestOptions,
27000
+ };
27001
+ },
26965
27002
  /**
26966
27003
  * Approve a pending evm message
26967
27004
  * @summary Approve a pending evm message
@@ -26994,6 +27031,39 @@ const MessagesApiAxiosParamCreator = function (configuration) {
26994
27031
  options: localVarRequestOptions,
26995
27032
  };
26996
27033
  },
27034
+ /**
27035
+ * Check if a given erc191 message is valid
27036
+ * @summary Evaluate an erc191 message to sign
27037
+ * @param {ERC191MessageEvaluationRequest} eRC191MessageEvaluationRequest Specifies the kind of transaction
27038
+ * @param {*} [options] Override http request option.
27039
+ * @throws {RequiredError}
27040
+ */
27041
+ evaluateErc191Message: async (eRC191MessageEvaluationRequest, options = {}) => {
27042
+ // verify required parameter 'eRC191MessageEvaluationRequest' is not null or undefined
27043
+ assertParamExists('evaluateErc191Message', 'eRC191MessageEvaluationRequest', eRC191MessageEvaluationRequest);
27044
+ const localVarPath = `/guardian/v1/erc191-messages/evaluate`;
27045
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
27046
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
27047
+ let baseOptions;
27048
+ if (configuration) {
27049
+ baseOptions = configuration.baseOptions;
27050
+ }
27051
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
27052
+ const localVarHeaderParameter = {};
27053
+ const localVarQueryParameter = {};
27054
+ // authentication BearerAuth required
27055
+ // http bearer authentication required
27056
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
27057
+ localVarHeaderParameter['Content-Type'] = 'application/json';
27058
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
27059
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
27060
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
27061
+ localVarRequestOptions.data = serializeDataIfNeeded(eRC191MessageEvaluationRequest, localVarRequestOptions, configuration);
27062
+ return {
27063
+ url: toPathString(localVarUrlObj),
27064
+ options: localVarRequestOptions,
27065
+ };
27066
+ },
26997
27067
  /**
26998
27068
  * Check if a given message is valid for EVM
26999
27069
  * @summary Evaluate an evm message to sign
@@ -27027,6 +27097,38 @@ const MessagesApiAxiosParamCreator = function (configuration) {
27027
27097
  options: localVarRequestOptions,
27028
27098
  };
27029
27099
  },
27100
+ /**
27101
+ * Get an erc191 message by id
27102
+ * @summary Info for a specific erc191 message
27103
+ * @param {string} messageID The id of the erc191 message
27104
+ * @param {*} [options] Override http request option.
27105
+ * @throws {RequiredError}
27106
+ */
27107
+ getErc191MessageByID: async (messageID, options = {}) => {
27108
+ // verify required parameter 'messageID' is not null or undefined
27109
+ assertParamExists('getErc191MessageByID', 'messageID', messageID);
27110
+ const localVarPath = `/guardian/v1/erc191-messages/{messageID}`
27111
+ .replace(`{${"messageID"}}`, encodeURIComponent(String(messageID)));
27112
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
27113
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
27114
+ let baseOptions;
27115
+ if (configuration) {
27116
+ baseOptions = configuration.baseOptions;
27117
+ }
27118
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
27119
+ const localVarHeaderParameter = {};
27120
+ const localVarQueryParameter = {};
27121
+ // authentication BearerAuth required
27122
+ // http bearer authentication required
27123
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
27124
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
27125
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
27126
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
27127
+ return {
27128
+ url: toPathString(localVarUrlObj),
27129
+ options: localVarRequestOptions,
27130
+ };
27131
+ },
27030
27132
  /**
27031
27133
  * Get an evm message by id
27032
27134
  * @summary Info for a specific evm message
@@ -27068,6 +27170,19 @@ const MessagesApiAxiosParamCreator = function (configuration) {
27068
27170
  const MessagesApiFp = function (configuration) {
27069
27171
  const localVarAxiosParamCreator = MessagesApiAxiosParamCreator(configuration);
27070
27172
  return {
27173
+ /**
27174
+ * Approve a pending erc191 message
27175
+ * @summary Approve a pending erc191 message
27176
+ * @param {string} messageID id for the message
27177
+ * @param {*} [options] Override http request option.
27178
+ * @throws {RequiredError}
27179
+ */
27180
+ async approvePendingERC191Message(messageID, options) {
27181
+ const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingERC191Message(messageID, options);
27182
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27183
+ const localVarOperationServerBasePath = operationServerMap['MessagesApi.approvePendingERC191Message']?.[localVarOperationServerIndex]?.url;
27184
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27185
+ },
27071
27186
  /**
27072
27187
  * Approve a pending evm message
27073
27188
  * @summary Approve a pending evm message
@@ -27077,7 +27192,22 @@ const MessagesApiFp = function (configuration) {
27077
27192
  */
27078
27193
  async approvePendingMessage(messageID, options) {
27079
27194
  const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingMessage(messageID, options);
27080
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
27195
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27196
+ const localVarOperationServerBasePath = operationServerMap['MessagesApi.approvePendingMessage']?.[localVarOperationServerIndex]?.url;
27197
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27198
+ },
27199
+ /**
27200
+ * Check if a given erc191 message is valid
27201
+ * @summary Evaluate an erc191 message to sign
27202
+ * @param {ERC191MessageEvaluationRequest} eRC191MessageEvaluationRequest Specifies the kind of transaction
27203
+ * @param {*} [options] Override http request option.
27204
+ * @throws {RequiredError}
27205
+ */
27206
+ async evaluateErc191Message(eRC191MessageEvaluationRequest, options) {
27207
+ const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateErc191Message(eRC191MessageEvaluationRequest, options);
27208
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27209
+ const localVarOperationServerBasePath = operationServerMap['MessagesApi.evaluateErc191Message']?.[localVarOperationServerIndex]?.url;
27210
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27081
27211
  },
27082
27212
  /**
27083
27213
  * Check if a given message is valid for EVM
@@ -27088,7 +27218,22 @@ const MessagesApiFp = function (configuration) {
27088
27218
  */
27089
27219
  async evaluateMessage(messageEvaluationRequest, options) {
27090
27220
  const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateMessage(messageEvaluationRequest, options);
27091
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
27221
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27222
+ const localVarOperationServerBasePath = operationServerMap['MessagesApi.evaluateMessage']?.[localVarOperationServerIndex]?.url;
27223
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27224
+ },
27225
+ /**
27226
+ * Get an erc191 message by id
27227
+ * @summary Info for a specific erc191 message
27228
+ * @param {string} messageID The id of the erc191 message
27229
+ * @param {*} [options] Override http request option.
27230
+ * @throws {RequiredError}
27231
+ */
27232
+ async getErc191MessageByID(messageID, options) {
27233
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getErc191MessageByID(messageID, options);
27234
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27235
+ const localVarOperationServerBasePath = operationServerMap['MessagesApi.getErc191MessageByID']?.[localVarOperationServerIndex]?.url;
27236
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27092
27237
  },
27093
27238
  /**
27094
27239
  * Get an evm message by id
@@ -27099,7 +27244,9 @@ const MessagesApiFp = function (configuration) {
27099
27244
  */
27100
27245
  async getMessageByID(messageID, options) {
27101
27246
  const localVarAxiosArgs = await localVarAxiosParamCreator.getMessageByID(messageID, options);
27102
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
27247
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27248
+ const localVarOperationServerBasePath = operationServerMap['MessagesApi.getMessageByID']?.[localVarOperationServerIndex]?.url;
27249
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27103
27250
  },
27104
27251
  };
27105
27252
  };
@@ -27110,6 +27257,17 @@ const MessagesApiFp = function (configuration) {
27110
27257
  * @extends {BaseAPI}
27111
27258
  */
27112
27259
  class MessagesApi extends BaseAPI {
27260
+ /**
27261
+ * Approve a pending erc191 message
27262
+ * @summary Approve a pending erc191 message
27263
+ * @param {MessagesApiApprovePendingERC191MessageRequest} requestParameters Request parameters.
27264
+ * @param {*} [options] Override http request option.
27265
+ * @throws {RequiredError}
27266
+ * @memberof MessagesApi
27267
+ */
27268
+ approvePendingERC191Message(requestParameters, options) {
27269
+ return MessagesApiFp(this.configuration).approvePendingERC191Message(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath));
27270
+ }
27113
27271
  /**
27114
27272
  * Approve a pending evm message
27115
27273
  * @summary Approve a pending evm message
@@ -27121,6 +27279,17 @@ class MessagesApi extends BaseAPI {
27121
27279
  approvePendingMessage(requestParameters, options) {
27122
27280
  return MessagesApiFp(this.configuration).approvePendingMessage(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath));
27123
27281
  }
27282
+ /**
27283
+ * Check if a given erc191 message is valid
27284
+ * @summary Evaluate an erc191 message to sign
27285
+ * @param {MessagesApiEvaluateErc191MessageRequest} requestParameters Request parameters.
27286
+ * @param {*} [options] Override http request option.
27287
+ * @throws {RequiredError}
27288
+ * @memberof MessagesApi
27289
+ */
27290
+ evaluateErc191Message(requestParameters, options) {
27291
+ return MessagesApiFp(this.configuration).evaluateErc191Message(requestParameters.eRC191MessageEvaluationRequest, options).then((request) => request(this.axios, this.basePath));
27292
+ }
27124
27293
  /**
27125
27294
  * Check if a given message is valid for EVM
27126
27295
  * @summary Evaluate an evm message to sign
@@ -27132,6 +27301,17 @@ class MessagesApi extends BaseAPI {
27132
27301
  evaluateMessage(requestParameters, options) {
27133
27302
  return MessagesApiFp(this.configuration).evaluateMessage(requestParameters.messageEvaluationRequest, options).then((request) => request(this.axios, this.basePath));
27134
27303
  }
27304
+ /**
27305
+ * Get an erc191 message by id
27306
+ * @summary Info for a specific erc191 message
27307
+ * @param {MessagesApiGetErc191MessageByIDRequest} requestParameters Request parameters.
27308
+ * @param {*} [options] Override http request option.
27309
+ * @throws {RequiredError}
27310
+ * @memberof MessagesApi
27311
+ */
27312
+ getErc191MessageByID(requestParameters, options) {
27313
+ return MessagesApiFp(this.configuration).getErc191MessageByID(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath));
27314
+ }
27135
27315
  /**
27136
27316
  * Get an evm message by id
27137
27317
  * @summary Info for a specific evm message
@@ -27242,7 +27422,7 @@ const TransactionsApiAxiosParamCreator = function (configuration) {
27242
27422
  * Get a transaction by payload hash
27243
27423
  * @summary Info for a specific transaction
27244
27424
  * @param {string} transactionID The id of the starkex transaction to retrieve
27245
- * @param {'starkex' | 'evm'} chainType roll up type
27425
+ * @param {GetTransactionByIDChainTypeEnum} chainType roll up type
27246
27426
  * @param {string} [chainID] ID of evm chain
27247
27427
  * @param {*} [options] Override http request option.
27248
27428
  * @throws {RequiredError}
@@ -27299,7 +27479,9 @@ const TransactionsApiFp = function (configuration) {
27299
27479
  */
27300
27480
  async approvePendingTransaction(payloadHash, transactionApprovalRequest, options) {
27301
27481
  const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingTransaction(payloadHash, transactionApprovalRequest, options);
27302
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
27482
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27483
+ const localVarOperationServerBasePath = operationServerMap['TransactionsApi.approvePendingTransaction']?.[localVarOperationServerIndex]?.url;
27484
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27303
27485
  },
27304
27486
  /**
27305
27487
  * Check if the transaction is valid by transaction ID for both StarkEx and EVM
@@ -27311,20 +27493,24 @@ const TransactionsApiFp = function (configuration) {
27311
27493
  */
27312
27494
  async evaluateTransaction(id, transactionEvaluationRequest, options) {
27313
27495
  const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateTransaction(id, transactionEvaluationRequest, options);
27314
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
27496
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27497
+ const localVarOperationServerBasePath = operationServerMap['TransactionsApi.evaluateTransaction']?.[localVarOperationServerIndex]?.url;
27498
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27315
27499
  },
27316
27500
  /**
27317
27501
  * Get a transaction by payload hash
27318
27502
  * @summary Info for a specific transaction
27319
27503
  * @param {string} transactionID The id of the starkex transaction to retrieve
27320
- * @param {'starkex' | 'evm'} chainType roll up type
27504
+ * @param {GetTransactionByIDChainTypeEnum} chainType roll up type
27321
27505
  * @param {string} [chainID] ID of evm chain
27322
27506
  * @param {*} [options] Override http request option.
27323
27507
  * @throws {RequiredError}
27324
27508
  */
27325
27509
  async getTransactionByID(transactionID, chainType, chainID, options) {
27326
27510
  const localVarAxiosArgs = await localVarAxiosParamCreator.getTransactionByID(transactionID, chainType, chainID, options);
27327
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
27511
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
27512
+ const localVarOperationServerBasePath = operationServerMap['TransactionsApi.getTransactionByID']?.[localVarOperationServerIndex]?.url;
27513
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
27328
27514
  },
27329
27515
  };
27330
27516
  };
@@ -27418,6 +27604,13 @@ class Configuration {
27418
27604
  * @memberof Configuration
27419
27605
  */
27420
27606
  basePath;
27607
+ /**
27608
+ * override server index
27609
+ *
27610
+ * @type {number}
27611
+ * @memberof Configuration
27612
+ */
27613
+ serverIndex;
27421
27614
  /**
27422
27615
  * base options for axios calls
27423
27616
  *
@@ -27439,6 +27632,7 @@ class Configuration {
27439
27632
  this.password = param.password;
27440
27633
  this.accessToken = param.accessToken;
27441
27634
  this.basePath = param.basePath;
27635
+ this.serverIndex = param.serverIndex;
27442
27636
  this.baseOptions = param.baseOptions;
27443
27637
  this.formDataCtor = param.formDataCtor;
27444
27638
  }
@@ -29307,7 +29501,7 @@ class ConfirmationScreen {
29307
29501
  this.showConfirmationScreen(href, messageHandler, resolve);
29308
29502
  });
29309
29503
  }
29310
- requestMessageConfirmation(messageID, etherAddress) {
29504
+ requestMessageConfirmation(messageID, etherAddress, messageType) {
29311
29505
  return new Promise((resolve, reject) => {
29312
29506
  const messageHandler = ({ data, origin }) => {
29313
29507
  if (origin !== this.config.passportDomain
@@ -29343,7 +29537,11 @@ class ConfirmationScreen {
29343
29537
  }
29344
29538
  };
29345
29539
  window.addEventListener('message', messageHandler);
29346
- const href = this.getHref('zkevm/message', { messageID, etherAddress });
29540
+ const href = this.getHref('zkevm/message', {
29541
+ messageID,
29542
+ etherAddress,
29543
+ ...(messageType ? { messageType } : {}),
29544
+ });
29347
29545
  this.showConfirmationScreen(href, messageHandler, resolve);
29348
29546
  });
29349
29547
  }
@@ -29458,7 +29656,7 @@ class TypedEventEmitter {
29458
29656
 
29459
29657
  const SIGNATURE_WEIGHT = 1; // Weight of a single signature in the multi-sig
29460
29658
  const TRANSACTION_SIGNATURE_THRESHOLD = 1; // Total required weight in the multi-sig for a transaction
29461
- const EIP712_SIGNATURE_THRESHOLD = 2; // Total required weight in the multi-sig for data signing
29659
+ const PACKED_SIGNATURE_THRESHOLD = 2; // Total required weight in the multi-sig for data signing
29462
29660
  const ETH_SIGN_FLAG = '02';
29463
29661
  const ETH_SIGN_PREFIX = '\x19\x01';
29464
29662
  const META_TRANSACTIONS_TYPE = `tuple(
@@ -29503,7 +29701,7 @@ const getNonce = async (rpcProvider, smartContractWalletAddress) => {
29503
29701
  throw new Error('Unexpected result from contract.nonce() call.');
29504
29702
  };
29505
29703
  const encodeMessageSubDigest = (chainId, walletAddress, digest) => (ethers.utils.solidityPack(['string', 'uint256', 'address', 'bytes32'], [ETH_SIGN_PREFIX, chainId, walletAddress, digest]));
29506
- const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
29704
+ const signMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
29507
29705
  const normalisedMetaTransactions = getNormalisedTransactions(metaTransactions);
29508
29706
  // Get the hash
29509
29707
  const digest = digestOfTransactionsAndNonce(nonce, normalisedMetaTransactions);
@@ -29536,29 +29734,14 @@ const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walle
29536
29734
  encodedSignature,
29537
29735
  ]);
29538
29736
  };
29539
- const decodeRelayerTypedDataSignature = (relayerSignature) => {
29737
+ const decodeRelayerSignature = (relayerSignature) => {
29540
29738
  const signatureWithThreshold = `0x0000${relayerSignature}`;
29541
29739
  return core.v1.signature.decodeSignature(signatureWithThreshold);
29542
29740
  };
29543
- const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAddress, signer) => {
29544
- // Ethers auto-generates the EIP712Domain type in the TypedDataEncoder, and so it needs to be removed
29545
- const types = { ...typedData.types };
29546
- // @ts-ignore
29547
- delete types.EIP712Domain;
29548
- // Hash the EIP712 payload and generate the complete payload
29549
- const { _TypedDataEncoder: typedDataEncoder } = ethers.utils;
29550
- const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
29551
- const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
29552
- const hash = ethers.utils.keccak256(messageSubDigest);
29553
- // Sign the sub digest
29554
- // https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
29555
- const hashArray = ethers.utils.arrayify(hash);
29556
- const startTime = performance.now();
29557
- const ethsigNoType = await signer.signMessage(hashArray);
29558
- trackDuration('passport', 'magicSignMessageTypedData', Math.round(performance.now() - startTime));
29559
- const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
29741
+ const packSignatures = (EOASignature, EOAAddress, relayerSignature) => {
29742
+ const signedDigest = `${EOASignature}${ETH_SIGN_FLAG}`;
29560
29743
  // Combine the relayer and user signatures; sort by address to match the imageHash order
29561
- const { signers: relayerSigners } = decodeRelayerTypedDataSignature(relayerSignature);
29744
+ const { signers: relayerSigners } = decodeRelayerSignature(relayerSignature);
29562
29745
  const combinedSigners = [
29563
29746
  ...relayerSigners,
29564
29747
  {
@@ -29566,7 +29749,7 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
29566
29749
  unrecovered: true,
29567
29750
  weight: SIGNATURE_WEIGHT,
29568
29751
  signature: signedDigest,
29569
- address: await signer.getAddress(),
29752
+ address: EOAAddress,
29570
29753
  },
29571
29754
  ];
29572
29755
  const sortedSigners = combinedSigners.sort((a, b) => {
@@ -29582,10 +29765,38 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
29582
29765
  });
29583
29766
  return core.v1.signature.encodeSignature({
29584
29767
  version: 1,
29585
- threshold: EIP712_SIGNATURE_THRESHOLD,
29768
+ threshold: PACKED_SIGNATURE_THRESHOLD,
29586
29769
  signers: sortedSigners,
29587
29770
  });
29588
29771
  };
29772
+ const signAndPackTypedData = async (typedData, relayerSignature, chainId, walletAddress, signer) => {
29773
+ // Ethers auto-generates the EIP712Domain type in the TypedDataEncoder, and so it needs to be removed
29774
+ const types = { ...typedData.types };
29775
+ // @ts-ignore
29776
+ delete types.EIP712Domain;
29777
+ // Hash the EIP712 payload and generate the complete payload
29778
+ const { _TypedDataEncoder: typedDataEncoder } = ethers.utils;
29779
+ const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
29780
+ const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
29781
+ const hash = ethers.utils.keccak256(messageSubDigest);
29782
+ // Sign the sub digest
29783
+ // https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
29784
+ const hashArray = ethers.utils.arrayify(hash);
29785
+ const startTime = performance.now();
29786
+ const eoaSignature = await signer.signMessage(hashArray);
29787
+ trackDuration('passport', 'magicSignMessageTypedData', Math.round(performance.now() - startTime));
29788
+ const eoaAddress = await signer.getAddress();
29789
+ return packSignatures(eoaSignature, eoaAddress, relayerSignature);
29790
+ };
29791
+ const signERC191Message = async (chainId, payload, signer, walletAddress) => {
29792
+ // Generate digest
29793
+ const digest = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(payload));
29794
+ // Generate subDigest
29795
+ const subDigest = encodeMessageSubDigest(chainId, walletAddress, digest);
29796
+ const subDigestHash = ethers.utils.keccak256(subDigest);
29797
+ const subDigestHashArray = ethers.utils.arrayify(subDigestHash);
29798
+ return signer.signMessage(subDigestHashArray);
29799
+ };
29589
29800
  const getEip155ChainId = (chainId) => `eip155:${chainId}`;
29590
29801
 
29591
29802
  class RelayerClient {
@@ -29667,6 +29878,19 @@ class RelayerClient {
29667
29878
  const { result } = await this.postToRelayer(payload);
29668
29879
  return result;
29669
29880
  }
29881
+ async imSign(address, message) {
29882
+ const { chainId } = await this.rpcProvider.detectNetwork();
29883
+ const payload = {
29884
+ method: 'im_sign',
29885
+ params: [{
29886
+ address,
29887
+ message,
29888
+ chainId: getEip155ChainId(chainId),
29889
+ }],
29890
+ };
29891
+ const { result } = await this.postToRelayer(payload);
29892
+ return result;
29893
+ }
29670
29894
  }
29671
29895
 
29672
29896
  /**
@@ -29835,7 +30059,7 @@ class GuardianClient {
29835
30059
  const headers = { Authorization: `Bearer ${user.accessToken}` };
29836
30060
  const guardianTransactions = transformGuardianTransactions(metaTransactions);
29837
30061
  try {
29838
- const transactionEvaluationResponseAxiosResponse = await this.transactionAPI.evaluateTransaction({
30062
+ const response = await this.transactionAPI.evaluateTransaction({
29839
30063
  id: 'evm',
29840
30064
  transactionEvaluationRequest: {
29841
30065
  chainType: 'evm',
@@ -29847,7 +30071,7 @@ class GuardianClient {
29847
30071
  },
29848
30072
  },
29849
30073
  }, { headers });
29850
- return transactionEvaluationResponseAxiosResponse.data;
30074
+ return response.data;
29851
30075
  }
29852
30076
  catch (error) {
29853
30077
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -29875,11 +30099,11 @@ class GuardianClient {
29875
30099
  this.confirmationScreen.closeWindow();
29876
30100
  }
29877
30101
  }
29878
- async evaluateMessage({ chainID, payload }) {
30102
+ async handleEIP712MessageEvaluation({ chainID, payload }) {
29879
30103
  try {
29880
30104
  const user = await this.authManager.getUserZkEvm();
29881
30105
  if (user === null) {
29882
- throw new PassportError('evaluateMessage requires a valid ID token or refresh token. Please log in first', PassportErrorType.NOT_LOGGED_IN_ERROR);
30106
+ throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'User not logged in. Please log in first.');
29883
30107
  }
29884
30108
  const messageEvalResponse = await this.messageAPI.evaluateMessage({ messageEvaluationRequest: { chainID, payload } }, { headers: { Authorization: `Bearer ${user.accessToken}` } });
29885
30109
  return messageEvalResponse.data;
@@ -29889,14 +30113,49 @@ class GuardianClient {
29889
30113
  throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Message failed to validate with error: ${errorMessage}`);
29890
30114
  }
29891
30115
  }
29892
- async validateMessage({ chainID, payload }) {
29893
- const { messageId, confirmationRequired } = await this.evaluateMessage({ chainID, payload });
30116
+ async evaluateEIP712Message({ chainID, payload }) {
30117
+ const { messageId, confirmationRequired } = await this.handleEIP712MessageEvaluation({ chainID, payload });
30118
+ if (confirmationRequired && this.crossSdkBridgeEnabled) {
30119
+ throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, transactionRejectedCrossSdkBridgeError);
30120
+ }
30121
+ if (confirmationRequired && !!messageId) {
30122
+ const user = await this.authManager.getUserZkEvm();
30123
+ const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId, user.zkEvm.ethAddress, 'eip712');
30124
+ if (!confirmationResult.confirmed) {
30125
+ throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, 'Signature rejected by user');
30126
+ }
30127
+ }
30128
+ else {
30129
+ this.confirmationScreen.closeWindow();
30130
+ }
30131
+ }
30132
+ async handleERC191MessageEvaluation({ chainID, payload }) {
30133
+ try {
30134
+ const user = await this.authManager.getUserZkEvm();
30135
+ if (user === null) {
30136
+ throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'User not logged in. Please log in first.');
30137
+ }
30138
+ const messageEvalResponse = await this.messageAPI.evaluateErc191Message({
30139
+ eRC191MessageEvaluationRequest: {
30140
+ chainID: getEip155ChainId(chainID),
30141
+ payload,
30142
+ },
30143
+ }, { headers: { Authorization: `Bearer ${user.accessToken}` } });
30144
+ return messageEvalResponse.data;
30145
+ }
30146
+ catch (error) {
30147
+ const errorMessage = error instanceof Error ? error.message : String(error);
30148
+ throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Message failed to validate with error: ${errorMessage}`);
30149
+ }
30150
+ }
30151
+ async evaluateERC191Message({ chainID, payload }) {
30152
+ const { messageId, confirmationRequired } = await this.handleERC191MessageEvaluation({ chainID, payload });
29894
30153
  if (confirmationRequired && this.crossSdkBridgeEnabled) {
29895
30154
  throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, transactionRejectedCrossSdkBridgeError);
29896
30155
  }
29897
30156
  if (confirmationRequired && !!messageId) {
29898
30157
  const user = await this.authManager.getUserZkEvm();
29899
- const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId, user.zkEvm.ethAddress);
30158
+ const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId, user.zkEvm.ethAddress, 'erc191');
29900
30159
  if (!confirmationResult.confirmed) {
29901
30160
  throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, 'Signature rejected by user');
29902
30161
  }
@@ -29977,7 +30236,7 @@ const sendTransaction$1 = async ({ params, ethSigner, rpcProvider, relayerClient
29977
30236
  validateEVMTransactionPromise.then(() => flow.addEvent('endValidateEVMTransaction'));
29978
30237
  // NOTE: We sign again because we now are adding the fee transaction, so the
29979
30238
  // whole payload is different and needs a new signature.
29980
- const getSignedMetaTransactionsPromise = getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
30239
+ const getSignedMetaTransactionsPromise = signMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
29981
30240
  getSignedMetaTransactionsPromise.then(() => flow.addEvent('endGetSignedMetaTransactions'));
29982
30241
  const [, signedTransactions] = await Promise.all([
29983
30242
  validateEVMTransactionPromise,
@@ -30062,15 +30321,57 @@ const signTypedDataV4 = async ({ params, method, ethSigner, rpcProvider, relayer
30062
30321
  const { chainId } = await rpcProvider.detectNetwork();
30063
30322
  const typedData = transformTypedData(typedDataParam, chainId);
30064
30323
  flow.addEvent('endDetectNetwork');
30065
- await guardianClient.validateMessage({ chainID: String(chainId), payload: typedData });
30324
+ await guardianClient.evaluateEIP712Message({ chainID: String(chainId), payload: typedData });
30066
30325
  flow.addEvent('endValidateMessage');
30067
30326
  const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
30068
30327
  flow.addEvent('endRelayerSignTypedData');
30069
- const signature = await getSignedTypedData(typedData, relayerSignature, ethers.BigNumber.from(chainId), fromAddress, ethSigner);
30328
+ const signature = await signAndPackTypedData(typedData, relayerSignature, ethers.BigNumber.from(chainId), fromAddress, ethSigner);
30070
30329
  flow.addEvent('getSignedTypedData');
30071
30330
  return signature;
30072
30331
  };
30073
30332
 
30333
+ const hexToString = (hex) => {
30334
+ if (!hex)
30335
+ return hex;
30336
+ try {
30337
+ const stripped = ethers.utils.stripZeros(ethers.utils.arrayify(hex));
30338
+ const buff = Buffer.from(stripped);
30339
+ return buff.length === 32 ? hex : ethers.utils.toUtf8String(stripped);
30340
+ }
30341
+ catch (e) {
30342
+ return hex;
30343
+ }
30344
+ };
30345
+
30346
+ const personalSign = async ({ params, ethSigner, zkEvmAddress, rpcProvider, guardianClient, relayerClient, flow, }) => {
30347
+ const message = params[0];
30348
+ const fromAddress = params[1];
30349
+ if (!fromAddress || !message) {
30350
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'personal_sign requires an address and a message');
30351
+ }
30352
+ if (fromAddress.toLowerCase() !== zkEvmAddress.toLowerCase()) {
30353
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'personal_sign requires the signer to be the from address');
30354
+ }
30355
+ // Convert message into a string if it's a hex
30356
+ const payload = hexToString(message);
30357
+ const { chainId } = await rpcProvider.detectNetwork();
30358
+ flow.addEvent('endDetectNetwork');
30359
+ const chainIdBigNumber = ethers.BigNumber.from(chainId);
30360
+ // Sign the message with the EOA without blocking
30361
+ const eoaSignaturePromise = signERC191Message(chainIdBigNumber, payload, ethSigner, fromAddress);
30362
+ eoaSignaturePromise.then(() => flow.addEvent('endEOASignature'));
30363
+ await guardianClient.evaluateERC191Message({ chainID: chainId, payload });
30364
+ flow.addEvent('endEvaluateERC191Message');
30365
+ const [eoaSignature, relayerSignature] = await Promise.all([
30366
+ eoaSignaturePromise,
30367
+ relayerClient.imSign(fromAddress, payload),
30368
+ ]);
30369
+ flow.addEvent('endRelayerSign');
30370
+ const eoaAddress = await ethSigner.getAddress();
30371
+ flow.addEvent('endGetEOAAddress');
30372
+ return packSignatures(eoaSignature, eoaAddress, relayerSignature);
30373
+ };
30374
+
30074
30375
  const isZkEvmUser = (user) => 'zkEvm' in user;
30075
30376
  class ZkEvmProvider {
30076
30377
  #authManager;
@@ -30246,6 +30547,38 @@ class ZkEvmProvider {
30246
30547
  case 'eth_accounts': {
30247
30548
  return this.#zkEvmAddress ? [this.#zkEvmAddress] : [];
30248
30549
  }
30550
+ case 'personal_sign': {
30551
+ if (!this.#zkEvmAddress) {
30552
+ throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
30553
+ }
30554
+ const flow = trackFlow('passport', 'personalSign');
30555
+ try {
30556
+ return await this.#guardianClient.withConfirmationScreen({ width: 480, height: 720 })(async () => {
30557
+ const ethSigner = await this.#getSigner();
30558
+ flow.addEvent('endGetSigner');
30559
+ return await personalSign({
30560
+ params: request.params || [],
30561
+ ethSigner,
30562
+ zkEvmAddress: this.#zkEvmAddress,
30563
+ rpcProvider: this.#rpcProvider,
30564
+ guardianClient: this.#guardianClient,
30565
+ relayerClient: this.#relayerClient,
30566
+ flow,
30567
+ });
30568
+ });
30569
+ }
30570
+ catch (error) {
30571
+ let errorMessage = 'Unknown error';
30572
+ if (error instanceof Error) {
30573
+ errorMessage = error.message;
30574
+ }
30575
+ flow.addEvent('error', { errorMessage });
30576
+ throw error;
30577
+ }
30578
+ finally {
30579
+ flow.end();
30580
+ }
30581
+ }
30249
30582
  case 'eth_signTypedData':
30250
30583
  case 'eth_signTypedData_v4': {
30251
30584
  if (!this.#zkEvmAddress) {
@@ -60927,7 +61260,7 @@ const flattenProperties = (properties) => {
60927
61260
  };
60928
61261
 
60929
61262
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
60930
- const SDK_VERSION = '1.41.3';
61263
+ const SDK_VERSION = '1.42.0';
60931
61264
  const getFrameParentDomain = () => {
60932
61265
  if (isNode()) {
60933
61266
  return '';
@@ -66246,7 +66579,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
66246
66579
  maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
66247
66580
  };
66248
66581
 
66249
- const SDK_VERSION_MARKER = '1.41.3';
66582
+ const SDK_VERSION_MARKER = '1.42.0';
66250
66583
  // This SDK version is replaced by the `yarn build` command ran on the root level
66251
66584
  const globalPackageVersion = () => SDK_VERSION_MARKER;
66252
66585