@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/blockchain_data.js +2 -2
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +11 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +389 -56
- package/dist/index.js +389 -56
- package/dist/minting_backend.js +2 -2
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +386 -53
- package/dist/webhook.js +1 -1
- package/dist/x.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -162,7 +162,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
165
|
-
const SDK_VERSION$1 = '1.
|
|
165
|
+
const SDK_VERSION$1 = '1.42.0';
|
|
166
166
|
const getFrameParentDomain$1 = () => {
|
|
167
167
|
if (isNode$1()) {
|
|
168
168
|
return '';
|
|
@@ -14189,7 +14189,7 @@ class MultiRollupApiClients {
|
|
|
14189
14189
|
}
|
|
14190
14190
|
|
|
14191
14191
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14192
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
14192
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.42.0' };
|
|
14193
14193
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
14194
14194
|
if (!basePath.trim()) {
|
|
14195
14195
|
throw Error('basePath can not be empty');
|
|
@@ -14261,7 +14261,7 @@ class APIError extends Error {
|
|
|
14261
14261
|
|
|
14262
14262
|
/* eslint-disable implicit-arrow-linebreak */
|
|
14263
14263
|
const defaultHeaders$1 = {
|
|
14264
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.
|
|
14264
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.42.0',
|
|
14265
14265
|
};
|
|
14266
14266
|
/**
|
|
14267
14267
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14735,7 +14735,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14735
14735
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14736
14736
|
class ApiConfiguration extends index$2.Configuration {
|
|
14737
14737
|
}
|
|
14738
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
14738
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.42.0' };
|
|
14739
14739
|
/**
|
|
14740
14740
|
* @dev use createImmutableXConfiguration instead
|
|
14741
14741
|
*/
|
|
@@ -14776,7 +14776,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14776
14776
|
coreContractAddress,
|
|
14777
14777
|
registrationContractAddress,
|
|
14778
14778
|
registrationV4ContractAddress,
|
|
14779
|
-
sdkVersion: 'ts-immutable-sdk-1.
|
|
14779
|
+
sdkVersion: 'ts-immutable-sdk-1.42.0',
|
|
14780
14780
|
baseConfig,
|
|
14781
14781
|
});
|
|
14782
14782
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -26786,9 +26786,7 @@ var globalAxios = axios$2;
|
|
|
26786
26786
|
* https://openapi-generator.tech
|
|
26787
26787
|
* Do not edit the class manually.
|
|
26788
26788
|
*/
|
|
26789
|
-
|
|
26790
|
-
// @ts-ignore
|
|
26791
|
-
const BASE_PATH = "https://guardian.sandbox.imtbl.com".replace(/\/+$/, "");
|
|
26789
|
+
const BASE_PATH = "https://api.immutable.com".replace(/\/+$/, "");
|
|
26792
26790
|
/**
|
|
26793
26791
|
*
|
|
26794
26792
|
* @export
|
|
@@ -26803,7 +26801,7 @@ class BaseAPI {
|
|
|
26803
26801
|
this.axios = axios;
|
|
26804
26802
|
if (configuration) {
|
|
26805
26803
|
this.configuration = configuration;
|
|
26806
|
-
this.basePath = configuration.basePath
|
|
26804
|
+
this.basePath = configuration.basePath ?? basePath;
|
|
26807
26805
|
}
|
|
26808
26806
|
}
|
|
26809
26807
|
}
|
|
@@ -26815,12 +26813,17 @@ class BaseAPI {
|
|
|
26815
26813
|
*/
|
|
26816
26814
|
class RequiredError extends Error {
|
|
26817
26815
|
field;
|
|
26818
|
-
name = "RequiredError";
|
|
26819
26816
|
constructor(field, msg) {
|
|
26820
26817
|
super(msg);
|
|
26821
26818
|
this.field = field;
|
|
26819
|
+
this.name = "RequiredError";
|
|
26822
26820
|
}
|
|
26823
26821
|
}
|
|
26822
|
+
/**
|
|
26823
|
+
*
|
|
26824
|
+
* @export
|
|
26825
|
+
*/
|
|
26826
|
+
const operationServerMap = {};
|
|
26824
26827
|
|
|
26825
26828
|
/* tslint:disable */
|
|
26826
26829
|
/* eslint-disable */
|
|
@@ -26863,6 +26866,8 @@ const setBearerAuthToObject = async function (object, configuration) {
|
|
|
26863
26866
|
}
|
|
26864
26867
|
};
|
|
26865
26868
|
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
26869
|
+
if (parameter == null)
|
|
26870
|
+
return;
|
|
26866
26871
|
if (typeof parameter === "object") {
|
|
26867
26872
|
if (Array.isArray(parameter)) {
|
|
26868
26873
|
parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
@@ -26915,7 +26920,7 @@ const toPathString = function (url) {
|
|
|
26915
26920
|
*/
|
|
26916
26921
|
const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
26917
26922
|
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
26918
|
-
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath
|
|
26923
|
+
const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
26919
26924
|
return axios.request(axiosRequestArgs);
|
|
26920
26925
|
};
|
|
26921
26926
|
};
|
|
@@ -26939,6 +26944,38 @@ const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, confi
|
|
|
26939
26944
|
*/
|
|
26940
26945
|
const MessagesApiAxiosParamCreator = function (configuration) {
|
|
26941
26946
|
return {
|
|
26947
|
+
/**
|
|
26948
|
+
* Approve a pending erc191 message
|
|
26949
|
+
* @summary Approve a pending erc191 message
|
|
26950
|
+
* @param {string} messageID id for the message
|
|
26951
|
+
* @param {*} [options] Override http request option.
|
|
26952
|
+
* @throws {RequiredError}
|
|
26953
|
+
*/
|
|
26954
|
+
approvePendingERC191Message: async (messageID, options = {}) => {
|
|
26955
|
+
// verify required parameter 'messageID' is not null or undefined
|
|
26956
|
+
assertParamExists('approvePendingERC191Message', 'messageID', messageID);
|
|
26957
|
+
const localVarPath = `/guardian/v1/erc191-messages/{messageID}/approve`
|
|
26958
|
+
.replace(`{${"messageID"}}`, encodeURIComponent(String(messageID)));
|
|
26959
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
26960
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
26961
|
+
let baseOptions;
|
|
26962
|
+
if (configuration) {
|
|
26963
|
+
baseOptions = configuration.baseOptions;
|
|
26964
|
+
}
|
|
26965
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
26966
|
+
const localVarHeaderParameter = {};
|
|
26967
|
+
const localVarQueryParameter = {};
|
|
26968
|
+
// authentication BearerAuth required
|
|
26969
|
+
// http bearer authentication required
|
|
26970
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
26971
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
26972
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
26973
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
26974
|
+
return {
|
|
26975
|
+
url: toPathString(localVarUrlObj),
|
|
26976
|
+
options: localVarRequestOptions,
|
|
26977
|
+
};
|
|
26978
|
+
},
|
|
26942
26979
|
/**
|
|
26943
26980
|
* Approve a pending evm message
|
|
26944
26981
|
* @summary Approve a pending evm message
|
|
@@ -26971,6 +27008,39 @@ const MessagesApiAxiosParamCreator = function (configuration) {
|
|
|
26971
27008
|
options: localVarRequestOptions,
|
|
26972
27009
|
};
|
|
26973
27010
|
},
|
|
27011
|
+
/**
|
|
27012
|
+
* Check if a given erc191 message is valid
|
|
27013
|
+
* @summary Evaluate an erc191 message to sign
|
|
27014
|
+
* @param {ERC191MessageEvaluationRequest} eRC191MessageEvaluationRequest Specifies the kind of transaction
|
|
27015
|
+
* @param {*} [options] Override http request option.
|
|
27016
|
+
* @throws {RequiredError}
|
|
27017
|
+
*/
|
|
27018
|
+
evaluateErc191Message: async (eRC191MessageEvaluationRequest, options = {}) => {
|
|
27019
|
+
// verify required parameter 'eRC191MessageEvaluationRequest' is not null or undefined
|
|
27020
|
+
assertParamExists('evaluateErc191Message', 'eRC191MessageEvaluationRequest', eRC191MessageEvaluationRequest);
|
|
27021
|
+
const localVarPath = `/guardian/v1/erc191-messages/evaluate`;
|
|
27022
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
27023
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
27024
|
+
let baseOptions;
|
|
27025
|
+
if (configuration) {
|
|
27026
|
+
baseOptions = configuration.baseOptions;
|
|
27027
|
+
}
|
|
27028
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
27029
|
+
const localVarHeaderParameter = {};
|
|
27030
|
+
const localVarQueryParameter = {};
|
|
27031
|
+
// authentication BearerAuth required
|
|
27032
|
+
// http bearer authentication required
|
|
27033
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
27034
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
27035
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
27036
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
27037
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
27038
|
+
localVarRequestOptions.data = serializeDataIfNeeded(eRC191MessageEvaluationRequest, localVarRequestOptions, configuration);
|
|
27039
|
+
return {
|
|
27040
|
+
url: toPathString(localVarUrlObj),
|
|
27041
|
+
options: localVarRequestOptions,
|
|
27042
|
+
};
|
|
27043
|
+
},
|
|
26974
27044
|
/**
|
|
26975
27045
|
* Check if a given message is valid for EVM
|
|
26976
27046
|
* @summary Evaluate an evm message to sign
|
|
@@ -27004,6 +27074,38 @@ const MessagesApiAxiosParamCreator = function (configuration) {
|
|
|
27004
27074
|
options: localVarRequestOptions,
|
|
27005
27075
|
};
|
|
27006
27076
|
},
|
|
27077
|
+
/**
|
|
27078
|
+
* Get an erc191 message by id
|
|
27079
|
+
* @summary Info for a specific erc191 message
|
|
27080
|
+
* @param {string} messageID The id of the erc191 message
|
|
27081
|
+
* @param {*} [options] Override http request option.
|
|
27082
|
+
* @throws {RequiredError}
|
|
27083
|
+
*/
|
|
27084
|
+
getErc191MessageByID: async (messageID, options = {}) => {
|
|
27085
|
+
// verify required parameter 'messageID' is not null or undefined
|
|
27086
|
+
assertParamExists('getErc191MessageByID', 'messageID', messageID);
|
|
27087
|
+
const localVarPath = `/guardian/v1/erc191-messages/{messageID}`
|
|
27088
|
+
.replace(`{${"messageID"}}`, encodeURIComponent(String(messageID)));
|
|
27089
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
27090
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
27091
|
+
let baseOptions;
|
|
27092
|
+
if (configuration) {
|
|
27093
|
+
baseOptions = configuration.baseOptions;
|
|
27094
|
+
}
|
|
27095
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
27096
|
+
const localVarHeaderParameter = {};
|
|
27097
|
+
const localVarQueryParameter = {};
|
|
27098
|
+
// authentication BearerAuth required
|
|
27099
|
+
// http bearer authentication required
|
|
27100
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
27101
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
27102
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
27103
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
27104
|
+
return {
|
|
27105
|
+
url: toPathString(localVarUrlObj),
|
|
27106
|
+
options: localVarRequestOptions,
|
|
27107
|
+
};
|
|
27108
|
+
},
|
|
27007
27109
|
/**
|
|
27008
27110
|
* Get an evm message by id
|
|
27009
27111
|
* @summary Info for a specific evm message
|
|
@@ -27045,6 +27147,19 @@ const MessagesApiAxiosParamCreator = function (configuration) {
|
|
|
27045
27147
|
const MessagesApiFp = function (configuration) {
|
|
27046
27148
|
const localVarAxiosParamCreator = MessagesApiAxiosParamCreator(configuration);
|
|
27047
27149
|
return {
|
|
27150
|
+
/**
|
|
27151
|
+
* Approve a pending erc191 message
|
|
27152
|
+
* @summary Approve a pending erc191 message
|
|
27153
|
+
* @param {string} messageID id for the message
|
|
27154
|
+
* @param {*} [options] Override http request option.
|
|
27155
|
+
* @throws {RequiredError}
|
|
27156
|
+
*/
|
|
27157
|
+
async approvePendingERC191Message(messageID, options) {
|
|
27158
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingERC191Message(messageID, options);
|
|
27159
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27160
|
+
const localVarOperationServerBasePath = operationServerMap['MessagesApi.approvePendingERC191Message']?.[localVarOperationServerIndex]?.url;
|
|
27161
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27162
|
+
},
|
|
27048
27163
|
/**
|
|
27049
27164
|
* Approve a pending evm message
|
|
27050
27165
|
* @summary Approve a pending evm message
|
|
@@ -27054,7 +27169,22 @@ const MessagesApiFp = function (configuration) {
|
|
|
27054
27169
|
*/
|
|
27055
27170
|
async approvePendingMessage(messageID, options) {
|
|
27056
27171
|
const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingMessage(messageID, options);
|
|
27057
|
-
|
|
27172
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27173
|
+
const localVarOperationServerBasePath = operationServerMap['MessagesApi.approvePendingMessage']?.[localVarOperationServerIndex]?.url;
|
|
27174
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27175
|
+
},
|
|
27176
|
+
/**
|
|
27177
|
+
* Check if a given erc191 message is valid
|
|
27178
|
+
* @summary Evaluate an erc191 message to sign
|
|
27179
|
+
* @param {ERC191MessageEvaluationRequest} eRC191MessageEvaluationRequest Specifies the kind of transaction
|
|
27180
|
+
* @param {*} [options] Override http request option.
|
|
27181
|
+
* @throws {RequiredError}
|
|
27182
|
+
*/
|
|
27183
|
+
async evaluateErc191Message(eRC191MessageEvaluationRequest, options) {
|
|
27184
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateErc191Message(eRC191MessageEvaluationRequest, options);
|
|
27185
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27186
|
+
const localVarOperationServerBasePath = operationServerMap['MessagesApi.evaluateErc191Message']?.[localVarOperationServerIndex]?.url;
|
|
27187
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27058
27188
|
},
|
|
27059
27189
|
/**
|
|
27060
27190
|
* Check if a given message is valid for EVM
|
|
@@ -27065,7 +27195,22 @@ const MessagesApiFp = function (configuration) {
|
|
|
27065
27195
|
*/
|
|
27066
27196
|
async evaluateMessage(messageEvaluationRequest, options) {
|
|
27067
27197
|
const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateMessage(messageEvaluationRequest, options);
|
|
27068
|
-
|
|
27198
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27199
|
+
const localVarOperationServerBasePath = operationServerMap['MessagesApi.evaluateMessage']?.[localVarOperationServerIndex]?.url;
|
|
27200
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27201
|
+
},
|
|
27202
|
+
/**
|
|
27203
|
+
* Get an erc191 message by id
|
|
27204
|
+
* @summary Info for a specific erc191 message
|
|
27205
|
+
* @param {string} messageID The id of the erc191 message
|
|
27206
|
+
* @param {*} [options] Override http request option.
|
|
27207
|
+
* @throws {RequiredError}
|
|
27208
|
+
*/
|
|
27209
|
+
async getErc191MessageByID(messageID, options) {
|
|
27210
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getErc191MessageByID(messageID, options);
|
|
27211
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27212
|
+
const localVarOperationServerBasePath = operationServerMap['MessagesApi.getErc191MessageByID']?.[localVarOperationServerIndex]?.url;
|
|
27213
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27069
27214
|
},
|
|
27070
27215
|
/**
|
|
27071
27216
|
* Get an evm message by id
|
|
@@ -27076,7 +27221,9 @@ const MessagesApiFp = function (configuration) {
|
|
|
27076
27221
|
*/
|
|
27077
27222
|
async getMessageByID(messageID, options) {
|
|
27078
27223
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getMessageByID(messageID, options);
|
|
27079
|
-
|
|
27224
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27225
|
+
const localVarOperationServerBasePath = operationServerMap['MessagesApi.getMessageByID']?.[localVarOperationServerIndex]?.url;
|
|
27226
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27080
27227
|
},
|
|
27081
27228
|
};
|
|
27082
27229
|
};
|
|
@@ -27087,6 +27234,17 @@ const MessagesApiFp = function (configuration) {
|
|
|
27087
27234
|
* @extends {BaseAPI}
|
|
27088
27235
|
*/
|
|
27089
27236
|
class MessagesApi extends BaseAPI {
|
|
27237
|
+
/**
|
|
27238
|
+
* Approve a pending erc191 message
|
|
27239
|
+
* @summary Approve a pending erc191 message
|
|
27240
|
+
* @param {MessagesApiApprovePendingERC191MessageRequest} requestParameters Request parameters.
|
|
27241
|
+
* @param {*} [options] Override http request option.
|
|
27242
|
+
* @throws {RequiredError}
|
|
27243
|
+
* @memberof MessagesApi
|
|
27244
|
+
*/
|
|
27245
|
+
approvePendingERC191Message(requestParameters, options) {
|
|
27246
|
+
return MessagesApiFp(this.configuration).approvePendingERC191Message(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath));
|
|
27247
|
+
}
|
|
27090
27248
|
/**
|
|
27091
27249
|
* Approve a pending evm message
|
|
27092
27250
|
* @summary Approve a pending evm message
|
|
@@ -27098,6 +27256,17 @@ class MessagesApi extends BaseAPI {
|
|
|
27098
27256
|
approvePendingMessage(requestParameters, options) {
|
|
27099
27257
|
return MessagesApiFp(this.configuration).approvePendingMessage(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath));
|
|
27100
27258
|
}
|
|
27259
|
+
/**
|
|
27260
|
+
* Check if a given erc191 message is valid
|
|
27261
|
+
* @summary Evaluate an erc191 message to sign
|
|
27262
|
+
* @param {MessagesApiEvaluateErc191MessageRequest} requestParameters Request parameters.
|
|
27263
|
+
* @param {*} [options] Override http request option.
|
|
27264
|
+
* @throws {RequiredError}
|
|
27265
|
+
* @memberof MessagesApi
|
|
27266
|
+
*/
|
|
27267
|
+
evaluateErc191Message(requestParameters, options) {
|
|
27268
|
+
return MessagesApiFp(this.configuration).evaluateErc191Message(requestParameters.eRC191MessageEvaluationRequest, options).then((request) => request(this.axios, this.basePath));
|
|
27269
|
+
}
|
|
27101
27270
|
/**
|
|
27102
27271
|
* Check if a given message is valid for EVM
|
|
27103
27272
|
* @summary Evaluate an evm message to sign
|
|
@@ -27109,6 +27278,17 @@ class MessagesApi extends BaseAPI {
|
|
|
27109
27278
|
evaluateMessage(requestParameters, options) {
|
|
27110
27279
|
return MessagesApiFp(this.configuration).evaluateMessage(requestParameters.messageEvaluationRequest, options).then((request) => request(this.axios, this.basePath));
|
|
27111
27280
|
}
|
|
27281
|
+
/**
|
|
27282
|
+
* Get an erc191 message by id
|
|
27283
|
+
* @summary Info for a specific erc191 message
|
|
27284
|
+
* @param {MessagesApiGetErc191MessageByIDRequest} requestParameters Request parameters.
|
|
27285
|
+
* @param {*} [options] Override http request option.
|
|
27286
|
+
* @throws {RequiredError}
|
|
27287
|
+
* @memberof MessagesApi
|
|
27288
|
+
*/
|
|
27289
|
+
getErc191MessageByID(requestParameters, options) {
|
|
27290
|
+
return MessagesApiFp(this.configuration).getErc191MessageByID(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath));
|
|
27291
|
+
}
|
|
27112
27292
|
/**
|
|
27113
27293
|
* Get an evm message by id
|
|
27114
27294
|
* @summary Info for a specific evm message
|
|
@@ -27219,7 +27399,7 @@ const TransactionsApiAxiosParamCreator = function (configuration) {
|
|
|
27219
27399
|
* Get a transaction by payload hash
|
|
27220
27400
|
* @summary Info for a specific transaction
|
|
27221
27401
|
* @param {string} transactionID The id of the starkex transaction to retrieve
|
|
27222
|
-
* @param {
|
|
27402
|
+
* @param {GetTransactionByIDChainTypeEnum} chainType roll up type
|
|
27223
27403
|
* @param {string} [chainID] ID of evm chain
|
|
27224
27404
|
* @param {*} [options] Override http request option.
|
|
27225
27405
|
* @throws {RequiredError}
|
|
@@ -27276,7 +27456,9 @@ const TransactionsApiFp = function (configuration) {
|
|
|
27276
27456
|
*/
|
|
27277
27457
|
async approvePendingTransaction(payloadHash, transactionApprovalRequest, options) {
|
|
27278
27458
|
const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingTransaction(payloadHash, transactionApprovalRequest, options);
|
|
27279
|
-
|
|
27459
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27460
|
+
const localVarOperationServerBasePath = operationServerMap['TransactionsApi.approvePendingTransaction']?.[localVarOperationServerIndex]?.url;
|
|
27461
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27280
27462
|
},
|
|
27281
27463
|
/**
|
|
27282
27464
|
* Check if the transaction is valid by transaction ID for both StarkEx and EVM
|
|
@@ -27288,20 +27470,24 @@ const TransactionsApiFp = function (configuration) {
|
|
|
27288
27470
|
*/
|
|
27289
27471
|
async evaluateTransaction(id, transactionEvaluationRequest, options) {
|
|
27290
27472
|
const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateTransaction(id, transactionEvaluationRequest, options);
|
|
27291
|
-
|
|
27473
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27474
|
+
const localVarOperationServerBasePath = operationServerMap['TransactionsApi.evaluateTransaction']?.[localVarOperationServerIndex]?.url;
|
|
27475
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27292
27476
|
},
|
|
27293
27477
|
/**
|
|
27294
27478
|
* Get a transaction by payload hash
|
|
27295
27479
|
* @summary Info for a specific transaction
|
|
27296
27480
|
* @param {string} transactionID The id of the starkex transaction to retrieve
|
|
27297
|
-
* @param {
|
|
27481
|
+
* @param {GetTransactionByIDChainTypeEnum} chainType roll up type
|
|
27298
27482
|
* @param {string} [chainID] ID of evm chain
|
|
27299
27483
|
* @param {*} [options] Override http request option.
|
|
27300
27484
|
* @throws {RequiredError}
|
|
27301
27485
|
*/
|
|
27302
27486
|
async getTransactionByID(transactionID, chainType, chainID, options) {
|
|
27303
27487
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getTransactionByID(transactionID, chainType, chainID, options);
|
|
27304
|
-
|
|
27488
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
27489
|
+
const localVarOperationServerBasePath = operationServerMap['TransactionsApi.getTransactionByID']?.[localVarOperationServerIndex]?.url;
|
|
27490
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
27305
27491
|
},
|
|
27306
27492
|
};
|
|
27307
27493
|
};
|
|
@@ -27395,6 +27581,13 @@ class Configuration {
|
|
|
27395
27581
|
* @memberof Configuration
|
|
27396
27582
|
*/
|
|
27397
27583
|
basePath;
|
|
27584
|
+
/**
|
|
27585
|
+
* override server index
|
|
27586
|
+
*
|
|
27587
|
+
* @type {number}
|
|
27588
|
+
* @memberof Configuration
|
|
27589
|
+
*/
|
|
27590
|
+
serverIndex;
|
|
27398
27591
|
/**
|
|
27399
27592
|
* base options for axios calls
|
|
27400
27593
|
*
|
|
@@ -27416,6 +27609,7 @@ class Configuration {
|
|
|
27416
27609
|
this.password = param.password;
|
|
27417
27610
|
this.accessToken = param.accessToken;
|
|
27418
27611
|
this.basePath = param.basePath;
|
|
27612
|
+
this.serverIndex = param.serverIndex;
|
|
27419
27613
|
this.baseOptions = param.baseOptions;
|
|
27420
27614
|
this.formDataCtor = param.formDataCtor;
|
|
27421
27615
|
}
|
|
@@ -29284,7 +29478,7 @@ class ConfirmationScreen {
|
|
|
29284
29478
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
29285
29479
|
});
|
|
29286
29480
|
}
|
|
29287
|
-
requestMessageConfirmation(messageID, etherAddress) {
|
|
29481
|
+
requestMessageConfirmation(messageID, etherAddress, messageType) {
|
|
29288
29482
|
return new Promise((resolve, reject) => {
|
|
29289
29483
|
const messageHandler = ({ data, origin }) => {
|
|
29290
29484
|
if (origin !== this.config.passportDomain
|
|
@@ -29320,7 +29514,11 @@ class ConfirmationScreen {
|
|
|
29320
29514
|
}
|
|
29321
29515
|
};
|
|
29322
29516
|
window.addEventListener('message', messageHandler);
|
|
29323
|
-
const href = this.getHref('zkevm/message', {
|
|
29517
|
+
const href = this.getHref('zkevm/message', {
|
|
29518
|
+
messageID,
|
|
29519
|
+
etherAddress,
|
|
29520
|
+
...(messageType ? { messageType } : {}),
|
|
29521
|
+
});
|
|
29324
29522
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
29325
29523
|
});
|
|
29326
29524
|
}
|
|
@@ -29435,7 +29633,7 @@ class TypedEventEmitter {
|
|
|
29435
29633
|
|
|
29436
29634
|
const SIGNATURE_WEIGHT = 1; // Weight of a single signature in the multi-sig
|
|
29437
29635
|
const TRANSACTION_SIGNATURE_THRESHOLD = 1; // Total required weight in the multi-sig for a transaction
|
|
29438
|
-
const
|
|
29636
|
+
const PACKED_SIGNATURE_THRESHOLD = 2; // Total required weight in the multi-sig for data signing
|
|
29439
29637
|
const ETH_SIGN_FLAG = '02';
|
|
29440
29638
|
const ETH_SIGN_PREFIX = '\x19\x01';
|
|
29441
29639
|
const META_TRANSACTIONS_TYPE = `tuple(
|
|
@@ -29480,7 +29678,7 @@ const getNonce = async (rpcProvider, smartContractWalletAddress) => {
|
|
|
29480
29678
|
throw new Error('Unexpected result from contract.nonce() call.');
|
|
29481
29679
|
};
|
|
29482
29680
|
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (utils$e.solidityPack(['string', 'uint256', 'address', 'bytes32'], [ETH_SIGN_PREFIX, chainId, walletAddress, digest]));
|
|
29483
|
-
const
|
|
29681
|
+
const signMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
|
|
29484
29682
|
const normalisedMetaTransactions = getNormalisedTransactions(metaTransactions);
|
|
29485
29683
|
// Get the hash
|
|
29486
29684
|
const digest = digestOfTransactionsAndNonce(nonce, normalisedMetaTransactions);
|
|
@@ -29513,29 +29711,14 @@ const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walle
|
|
|
29513
29711
|
encodedSignature,
|
|
29514
29712
|
]);
|
|
29515
29713
|
};
|
|
29516
|
-
const
|
|
29714
|
+
const decodeRelayerSignature = (relayerSignature) => {
|
|
29517
29715
|
const signatureWithThreshold = `0x0000${relayerSignature}`;
|
|
29518
29716
|
return v1.signature.decodeSignature(signatureWithThreshold);
|
|
29519
29717
|
};
|
|
29520
|
-
const
|
|
29521
|
-
|
|
29522
|
-
const types = { ...typedData.types };
|
|
29523
|
-
// @ts-ignore
|
|
29524
|
-
delete types.EIP712Domain;
|
|
29525
|
-
// Hash the EIP712 payload and generate the complete payload
|
|
29526
|
-
const { _TypedDataEncoder: typedDataEncoder } = utils$e;
|
|
29527
|
-
const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
|
|
29528
|
-
const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
|
|
29529
|
-
const hash = utils$e.keccak256(messageSubDigest);
|
|
29530
|
-
// Sign the sub digest
|
|
29531
|
-
// https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
|
|
29532
|
-
const hashArray = utils$e.arrayify(hash);
|
|
29533
|
-
const startTime = performance.now();
|
|
29534
|
-
const ethsigNoType = await signer.signMessage(hashArray);
|
|
29535
|
-
trackDuration('passport', 'magicSignMessageTypedData', Math.round(performance.now() - startTime));
|
|
29536
|
-
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
29718
|
+
const packSignatures = (EOASignature, EOAAddress, relayerSignature) => {
|
|
29719
|
+
const signedDigest = `${EOASignature}${ETH_SIGN_FLAG}`;
|
|
29537
29720
|
// Combine the relayer and user signatures; sort by address to match the imageHash order
|
|
29538
|
-
const { signers: relayerSigners } =
|
|
29721
|
+
const { signers: relayerSigners } = decodeRelayerSignature(relayerSignature);
|
|
29539
29722
|
const combinedSigners = [
|
|
29540
29723
|
...relayerSigners,
|
|
29541
29724
|
{
|
|
@@ -29543,7 +29726,7 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
|
|
|
29543
29726
|
unrecovered: true,
|
|
29544
29727
|
weight: SIGNATURE_WEIGHT,
|
|
29545
29728
|
signature: signedDigest,
|
|
29546
|
-
address:
|
|
29729
|
+
address: EOAAddress,
|
|
29547
29730
|
},
|
|
29548
29731
|
];
|
|
29549
29732
|
const sortedSigners = combinedSigners.sort((a, b) => {
|
|
@@ -29559,10 +29742,38 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
|
|
|
29559
29742
|
});
|
|
29560
29743
|
return v1.signature.encodeSignature({
|
|
29561
29744
|
version: 1,
|
|
29562
|
-
threshold:
|
|
29745
|
+
threshold: PACKED_SIGNATURE_THRESHOLD,
|
|
29563
29746
|
signers: sortedSigners,
|
|
29564
29747
|
});
|
|
29565
29748
|
};
|
|
29749
|
+
const signAndPackTypedData = async (typedData, relayerSignature, chainId, walletAddress, signer) => {
|
|
29750
|
+
// Ethers auto-generates the EIP712Domain type in the TypedDataEncoder, and so it needs to be removed
|
|
29751
|
+
const types = { ...typedData.types };
|
|
29752
|
+
// @ts-ignore
|
|
29753
|
+
delete types.EIP712Domain;
|
|
29754
|
+
// Hash the EIP712 payload and generate the complete payload
|
|
29755
|
+
const { _TypedDataEncoder: typedDataEncoder } = utils$e;
|
|
29756
|
+
const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
|
|
29757
|
+
const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
|
|
29758
|
+
const hash = utils$e.keccak256(messageSubDigest);
|
|
29759
|
+
// Sign the sub digest
|
|
29760
|
+
// https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
|
|
29761
|
+
const hashArray = utils$e.arrayify(hash);
|
|
29762
|
+
const startTime = performance.now();
|
|
29763
|
+
const eoaSignature = await signer.signMessage(hashArray);
|
|
29764
|
+
trackDuration('passport', 'magicSignMessageTypedData', Math.round(performance.now() - startTime));
|
|
29765
|
+
const eoaAddress = await signer.getAddress();
|
|
29766
|
+
return packSignatures(eoaSignature, eoaAddress, relayerSignature);
|
|
29767
|
+
};
|
|
29768
|
+
const signERC191Message = async (chainId, payload, signer, walletAddress) => {
|
|
29769
|
+
// Generate digest
|
|
29770
|
+
const digest = utils$e.keccak256(utils$e.toUtf8Bytes(payload));
|
|
29771
|
+
// Generate subDigest
|
|
29772
|
+
const subDigest = encodeMessageSubDigest(chainId, walletAddress, digest);
|
|
29773
|
+
const subDigestHash = utils$e.keccak256(subDigest);
|
|
29774
|
+
const subDigestHashArray = utils$e.arrayify(subDigestHash);
|
|
29775
|
+
return signer.signMessage(subDigestHashArray);
|
|
29776
|
+
};
|
|
29566
29777
|
const getEip155ChainId = (chainId) => `eip155:${chainId}`;
|
|
29567
29778
|
|
|
29568
29779
|
class RelayerClient {
|
|
@@ -29644,6 +29855,19 @@ class RelayerClient {
|
|
|
29644
29855
|
const { result } = await this.postToRelayer(payload);
|
|
29645
29856
|
return result;
|
|
29646
29857
|
}
|
|
29858
|
+
async imSign(address, message) {
|
|
29859
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
29860
|
+
const payload = {
|
|
29861
|
+
method: 'im_sign',
|
|
29862
|
+
params: [{
|
|
29863
|
+
address,
|
|
29864
|
+
message,
|
|
29865
|
+
chainId: getEip155ChainId(chainId),
|
|
29866
|
+
}],
|
|
29867
|
+
};
|
|
29868
|
+
const { result } = await this.postToRelayer(payload);
|
|
29869
|
+
return result;
|
|
29870
|
+
}
|
|
29647
29871
|
}
|
|
29648
29872
|
|
|
29649
29873
|
/**
|
|
@@ -29812,7 +30036,7 @@ class GuardianClient {
|
|
|
29812
30036
|
const headers = { Authorization: `Bearer ${user.accessToken}` };
|
|
29813
30037
|
const guardianTransactions = transformGuardianTransactions(metaTransactions);
|
|
29814
30038
|
try {
|
|
29815
|
-
const
|
|
30039
|
+
const response = await this.transactionAPI.evaluateTransaction({
|
|
29816
30040
|
id: 'evm',
|
|
29817
30041
|
transactionEvaluationRequest: {
|
|
29818
30042
|
chainType: 'evm',
|
|
@@ -29824,7 +30048,7 @@ class GuardianClient {
|
|
|
29824
30048
|
},
|
|
29825
30049
|
},
|
|
29826
30050
|
}, { headers });
|
|
29827
|
-
return
|
|
30051
|
+
return response.data;
|
|
29828
30052
|
}
|
|
29829
30053
|
catch (error) {
|
|
29830
30054
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -29852,11 +30076,11 @@ class GuardianClient {
|
|
|
29852
30076
|
this.confirmationScreen.closeWindow();
|
|
29853
30077
|
}
|
|
29854
30078
|
}
|
|
29855
|
-
async
|
|
30079
|
+
async handleEIP712MessageEvaluation({ chainID, payload }) {
|
|
29856
30080
|
try {
|
|
29857
30081
|
const user = await this.authManager.getUserZkEvm();
|
|
29858
30082
|
if (user === null) {
|
|
29859
|
-
throw new
|
|
30083
|
+
throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'User not logged in. Please log in first.');
|
|
29860
30084
|
}
|
|
29861
30085
|
const messageEvalResponse = await this.messageAPI.evaluateMessage({ messageEvaluationRequest: { chainID, payload } }, { headers: { Authorization: `Bearer ${user.accessToken}` } });
|
|
29862
30086
|
return messageEvalResponse.data;
|
|
@@ -29866,14 +30090,49 @@ class GuardianClient {
|
|
|
29866
30090
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Message failed to validate with error: ${errorMessage}`);
|
|
29867
30091
|
}
|
|
29868
30092
|
}
|
|
29869
|
-
async
|
|
29870
|
-
const { messageId, confirmationRequired } = await this.
|
|
30093
|
+
async evaluateEIP712Message({ chainID, payload }) {
|
|
30094
|
+
const { messageId, confirmationRequired } = await this.handleEIP712MessageEvaluation({ chainID, payload });
|
|
30095
|
+
if (confirmationRequired && this.crossSdkBridgeEnabled) {
|
|
30096
|
+
throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, transactionRejectedCrossSdkBridgeError);
|
|
30097
|
+
}
|
|
30098
|
+
if (confirmationRequired && !!messageId) {
|
|
30099
|
+
const user = await this.authManager.getUserZkEvm();
|
|
30100
|
+
const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId, user.zkEvm.ethAddress, 'eip712');
|
|
30101
|
+
if (!confirmationResult.confirmed) {
|
|
30102
|
+
throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, 'Signature rejected by user');
|
|
30103
|
+
}
|
|
30104
|
+
}
|
|
30105
|
+
else {
|
|
30106
|
+
this.confirmationScreen.closeWindow();
|
|
30107
|
+
}
|
|
30108
|
+
}
|
|
30109
|
+
async handleERC191MessageEvaluation({ chainID, payload }) {
|
|
30110
|
+
try {
|
|
30111
|
+
const user = await this.authManager.getUserZkEvm();
|
|
30112
|
+
if (user === null) {
|
|
30113
|
+
throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'User not logged in. Please log in first.');
|
|
30114
|
+
}
|
|
30115
|
+
const messageEvalResponse = await this.messageAPI.evaluateErc191Message({
|
|
30116
|
+
eRC191MessageEvaluationRequest: {
|
|
30117
|
+
chainID: getEip155ChainId(chainID),
|
|
30118
|
+
payload,
|
|
30119
|
+
},
|
|
30120
|
+
}, { headers: { Authorization: `Bearer ${user.accessToken}` } });
|
|
30121
|
+
return messageEvalResponse.data;
|
|
30122
|
+
}
|
|
30123
|
+
catch (error) {
|
|
30124
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
30125
|
+
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Message failed to validate with error: ${errorMessage}`);
|
|
30126
|
+
}
|
|
30127
|
+
}
|
|
30128
|
+
async evaluateERC191Message({ chainID, payload }) {
|
|
30129
|
+
const { messageId, confirmationRequired } = await this.handleERC191MessageEvaluation({ chainID, payload });
|
|
29871
30130
|
if (confirmationRequired && this.crossSdkBridgeEnabled) {
|
|
29872
30131
|
throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, transactionRejectedCrossSdkBridgeError);
|
|
29873
30132
|
}
|
|
29874
30133
|
if (confirmationRequired && !!messageId) {
|
|
29875
30134
|
const user = await this.authManager.getUserZkEvm();
|
|
29876
|
-
const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId, user.zkEvm.ethAddress);
|
|
30135
|
+
const confirmationResult = await this.confirmationScreen.requestMessageConfirmation(messageId, user.zkEvm.ethAddress, 'erc191');
|
|
29877
30136
|
if (!confirmationResult.confirmed) {
|
|
29878
30137
|
throw new JsonRpcError(RpcErrorCode.TRANSACTION_REJECTED, 'Signature rejected by user');
|
|
29879
30138
|
}
|
|
@@ -29954,7 +30213,7 @@ const sendTransaction$1 = async ({ params, ethSigner, rpcProvider, relayerClient
|
|
|
29954
30213
|
validateEVMTransactionPromise.then(() => flow.addEvent('endValidateEVMTransaction'));
|
|
29955
30214
|
// NOTE: We sign again because we now are adding the fee transaction, so the
|
|
29956
30215
|
// whole payload is different and needs a new signature.
|
|
29957
|
-
const getSignedMetaTransactionsPromise =
|
|
30216
|
+
const getSignedMetaTransactionsPromise = signMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
|
|
29958
30217
|
getSignedMetaTransactionsPromise.then(() => flow.addEvent('endGetSignedMetaTransactions'));
|
|
29959
30218
|
const [, signedTransactions] = await Promise.all([
|
|
29960
30219
|
validateEVMTransactionPromise,
|
|
@@ -30039,15 +30298,57 @@ const signTypedDataV4 = async ({ params, method, ethSigner, rpcProvider, relayer
|
|
|
30039
30298
|
const { chainId } = await rpcProvider.detectNetwork();
|
|
30040
30299
|
const typedData = transformTypedData(typedDataParam, chainId);
|
|
30041
30300
|
flow.addEvent('endDetectNetwork');
|
|
30042
|
-
await guardianClient.
|
|
30301
|
+
await guardianClient.evaluateEIP712Message({ chainID: String(chainId), payload: typedData });
|
|
30043
30302
|
flow.addEvent('endValidateMessage');
|
|
30044
30303
|
const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
|
|
30045
30304
|
flow.addEvent('endRelayerSignTypedData');
|
|
30046
|
-
const signature = await
|
|
30305
|
+
const signature = await signAndPackTypedData(typedData, relayerSignature, BigNumber$1.from(chainId), fromAddress, ethSigner);
|
|
30047
30306
|
flow.addEvent('getSignedTypedData');
|
|
30048
30307
|
return signature;
|
|
30049
30308
|
};
|
|
30050
30309
|
|
|
30310
|
+
const hexToString = (hex) => {
|
|
30311
|
+
if (!hex)
|
|
30312
|
+
return hex;
|
|
30313
|
+
try {
|
|
30314
|
+
const stripped = utils$e.stripZeros(utils$e.arrayify(hex));
|
|
30315
|
+
const buff = Buffer.from(stripped);
|
|
30316
|
+
return buff.length === 32 ? hex : utils$e.toUtf8String(stripped);
|
|
30317
|
+
}
|
|
30318
|
+
catch (e) {
|
|
30319
|
+
return hex;
|
|
30320
|
+
}
|
|
30321
|
+
};
|
|
30322
|
+
|
|
30323
|
+
const personalSign = async ({ params, ethSigner, zkEvmAddress, rpcProvider, guardianClient, relayerClient, flow, }) => {
|
|
30324
|
+
const message = params[0];
|
|
30325
|
+
const fromAddress = params[1];
|
|
30326
|
+
if (!fromAddress || !message) {
|
|
30327
|
+
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'personal_sign requires an address and a message');
|
|
30328
|
+
}
|
|
30329
|
+
if (fromAddress.toLowerCase() !== zkEvmAddress.toLowerCase()) {
|
|
30330
|
+
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'personal_sign requires the signer to be the from address');
|
|
30331
|
+
}
|
|
30332
|
+
// Convert message into a string if it's a hex
|
|
30333
|
+
const payload = hexToString(message);
|
|
30334
|
+
const { chainId } = await rpcProvider.detectNetwork();
|
|
30335
|
+
flow.addEvent('endDetectNetwork');
|
|
30336
|
+
const chainIdBigNumber = BigNumber$1.from(chainId);
|
|
30337
|
+
// Sign the message with the EOA without blocking
|
|
30338
|
+
const eoaSignaturePromise = signERC191Message(chainIdBigNumber, payload, ethSigner, fromAddress);
|
|
30339
|
+
eoaSignaturePromise.then(() => flow.addEvent('endEOASignature'));
|
|
30340
|
+
await guardianClient.evaluateERC191Message({ chainID: chainId, payload });
|
|
30341
|
+
flow.addEvent('endEvaluateERC191Message');
|
|
30342
|
+
const [eoaSignature, relayerSignature] = await Promise.all([
|
|
30343
|
+
eoaSignaturePromise,
|
|
30344
|
+
relayerClient.imSign(fromAddress, payload),
|
|
30345
|
+
]);
|
|
30346
|
+
flow.addEvent('endRelayerSign');
|
|
30347
|
+
const eoaAddress = await ethSigner.getAddress();
|
|
30348
|
+
flow.addEvent('endGetEOAAddress');
|
|
30349
|
+
return packSignatures(eoaSignature, eoaAddress, relayerSignature);
|
|
30350
|
+
};
|
|
30351
|
+
|
|
30051
30352
|
const isZkEvmUser = (user) => 'zkEvm' in user;
|
|
30052
30353
|
class ZkEvmProvider {
|
|
30053
30354
|
#authManager;
|
|
@@ -30223,6 +30524,38 @@ class ZkEvmProvider {
|
|
|
30223
30524
|
case 'eth_accounts': {
|
|
30224
30525
|
return this.#zkEvmAddress ? [this.#zkEvmAddress] : [];
|
|
30225
30526
|
}
|
|
30527
|
+
case 'personal_sign': {
|
|
30528
|
+
if (!this.#zkEvmAddress) {
|
|
30529
|
+
throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
|
|
30530
|
+
}
|
|
30531
|
+
const flow = trackFlow('passport', 'personalSign');
|
|
30532
|
+
try {
|
|
30533
|
+
return await this.#guardianClient.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
30534
|
+
const ethSigner = await this.#getSigner();
|
|
30535
|
+
flow.addEvent('endGetSigner');
|
|
30536
|
+
return await personalSign({
|
|
30537
|
+
params: request.params || [],
|
|
30538
|
+
ethSigner,
|
|
30539
|
+
zkEvmAddress: this.#zkEvmAddress,
|
|
30540
|
+
rpcProvider: this.#rpcProvider,
|
|
30541
|
+
guardianClient: this.#guardianClient,
|
|
30542
|
+
relayerClient: this.#relayerClient,
|
|
30543
|
+
flow,
|
|
30544
|
+
});
|
|
30545
|
+
});
|
|
30546
|
+
}
|
|
30547
|
+
catch (error) {
|
|
30548
|
+
let errorMessage = 'Unknown error';
|
|
30549
|
+
if (error instanceof Error) {
|
|
30550
|
+
errorMessage = error.message;
|
|
30551
|
+
}
|
|
30552
|
+
flow.addEvent('error', { errorMessage });
|
|
30553
|
+
throw error;
|
|
30554
|
+
}
|
|
30555
|
+
finally {
|
|
30556
|
+
flow.end();
|
|
30557
|
+
}
|
|
30558
|
+
}
|
|
30226
30559
|
case 'eth_signTypedData':
|
|
30227
30560
|
case 'eth_signTypedData_v4': {
|
|
30228
30561
|
if (!this.#zkEvmAddress) {
|
|
@@ -60904,7 +61237,7 @@ const flattenProperties = (properties) => {
|
|
|
60904
61237
|
};
|
|
60905
61238
|
|
|
60906
61239
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
60907
|
-
const SDK_VERSION = '1.
|
|
61240
|
+
const SDK_VERSION = '1.42.0';
|
|
60908
61241
|
const getFrameParentDomain = () => {
|
|
60909
61242
|
if (isNode()) {
|
|
60910
61243
|
return '';
|
|
@@ -66223,7 +66556,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
66223
66556
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
66224
66557
|
};
|
|
66225
66558
|
|
|
66226
|
-
const SDK_VERSION_MARKER = '1.
|
|
66559
|
+
const SDK_VERSION_MARKER = '1.42.0';
|
|
66227
66560
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
66228
66561
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
66229
66562
|
|