-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ID-746 Passport - ZkEvm message signing
- Loading branch information
1 parent
289a865
commit 3c37b9a
Showing
47 changed files
with
2,078 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
331 changes: 331 additions & 0 deletions
331
packages/internal/guardian/src/client/domain/messages-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,331 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Guardian | ||
* Guardian API | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: support@immutable.com | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
import { Configuration } from '../configuration'; | ||
// Some imports not used depending on template conditions | ||
// @ts-ignore | ||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; | ||
// @ts-ignore | ||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; | ||
// @ts-ignore | ||
import { APIError400 } from '../models'; | ||
// @ts-ignore | ||
import { APIError403 } from '../models'; | ||
// @ts-ignore | ||
import { APIError404 } from '../models'; | ||
// @ts-ignore | ||
import { APIError500 } from '../models'; | ||
// @ts-ignore | ||
import { BasicAPIError } from '../models'; | ||
// @ts-ignore | ||
import { EVMMessage } from '../models'; | ||
// @ts-ignore | ||
import { MessageEvaluationRequest } from '../models'; | ||
// @ts-ignore | ||
import { MessageEvaluationResponse } from '../models'; | ||
/** | ||
* MessagesApi - axios parameter creator | ||
* @export | ||
*/ | ||
export const MessagesApiAxiosParamCreator = function (configuration?: Configuration) { | ||
return { | ||
/** | ||
* Approve a pending evm message | ||
* @summary Approve a pending evm message | ||
* @param {string} messageID id for the message | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
approvePendingMessage: async (messageID: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||
// verify required parameter 'messageID' is not null or undefined | ||
assertParamExists('approvePendingMessage', 'messageID', messageID) | ||
const localVarPath = `/guardian/v1/messages/{messageID}/approve` | ||
.replace(`{${"messageID"}}`, encodeURIComponent(String(messageID))); | ||
// use dummy base URL string because the URL constructor only accepts absolute URLs. | ||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||
let baseOptions; | ||
if (configuration) { | ||
baseOptions = configuration.baseOptions; | ||
} | ||
|
||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; | ||
const localVarHeaderParameter = {} as any; | ||
const localVarQueryParameter = {} as any; | ||
|
||
// authentication BearerAuth required | ||
// http bearer authentication required | ||
await setBearerAuthToObject(localVarHeaderParameter, configuration) | ||
|
||
|
||
|
||
setSearchParams(localVarUrlObj, localVarQueryParameter); | ||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||
|
||
return { | ||
url: toPathString(localVarUrlObj), | ||
options: localVarRequestOptions, | ||
}; | ||
}, | ||
/** | ||
* Check if a given message is valid for EVM | ||
* @summary Evaluate an evm message to sign | ||
* @param {MessageEvaluationRequest} messageEvaluationRequest Specifies the kind of transaction | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
evaluateMessage: async (messageEvaluationRequest: MessageEvaluationRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||
// verify required parameter 'messageEvaluationRequest' is not null or undefined | ||
assertParamExists('evaluateMessage', 'messageEvaluationRequest', messageEvaluationRequest) | ||
const localVarPath = `/guardian/v1/messages/evaluate`; | ||
// use dummy base URL string because the URL constructor only accepts absolute URLs. | ||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||
let baseOptions; | ||
if (configuration) { | ||
baseOptions = configuration.baseOptions; | ||
} | ||
|
||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; | ||
const localVarHeaderParameter = {} as any; | ||
const localVarQueryParameter = {} as any; | ||
|
||
// authentication BearerAuth required | ||
// http bearer authentication required | ||
await setBearerAuthToObject(localVarHeaderParameter, configuration) | ||
|
||
|
||
|
||
localVarHeaderParameter['Content-Type'] = 'application/json'; | ||
|
||
setSearchParams(localVarUrlObj, localVarQueryParameter); | ||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||
localVarRequestOptions.data = serializeDataIfNeeded(messageEvaluationRequest, localVarRequestOptions, configuration) | ||
|
||
return { | ||
url: toPathString(localVarUrlObj), | ||
options: localVarRequestOptions, | ||
}; | ||
}, | ||
/** | ||
* Get an evm message by id | ||
* @summary Info for a specific evm message | ||
* @param {string} messageID The id of the evm message | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
getMessageByID: async (messageID: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { | ||
// verify required parameter 'messageID' is not null or undefined | ||
assertParamExists('getMessageByID', 'messageID', messageID) | ||
const localVarPath = `/guardian/v1/messages/{messageID}` | ||
.replace(`{${"messageID"}}`, encodeURIComponent(String(messageID))); | ||
// use dummy base URL string because the URL constructor only accepts absolute URLs. | ||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||
let baseOptions; | ||
if (configuration) { | ||
baseOptions = configuration.baseOptions; | ||
} | ||
|
||
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; | ||
const localVarHeaderParameter = {} as any; | ||
const localVarQueryParameter = {} as any; | ||
|
||
// authentication BearerAuth required | ||
// http bearer authentication required | ||
await setBearerAuthToObject(localVarHeaderParameter, configuration) | ||
|
||
|
||
|
||
setSearchParams(localVarUrlObj, localVarQueryParameter); | ||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; | ||
|
||
return { | ||
url: toPathString(localVarUrlObj), | ||
options: localVarRequestOptions, | ||
}; | ||
}, | ||
} | ||
}; | ||
|
||
/** | ||
* MessagesApi - functional programming interface | ||
* @export | ||
*/ | ||
export const MessagesApiFp = function(configuration?: Configuration) { | ||
const localVarAxiosParamCreator = MessagesApiAxiosParamCreator(configuration) | ||
return { | ||
/** | ||
* Approve a pending evm message | ||
* @summary Approve a pending evm message | ||
* @param {string} messageID id for the message | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
async approvePendingMessage(messageID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> { | ||
const localVarAxiosArgs = await localVarAxiosParamCreator.approvePendingMessage(messageID, options); | ||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||
}, | ||
/** | ||
* Check if a given message is valid for EVM | ||
* @summary Evaluate an evm message to sign | ||
* @param {MessageEvaluationRequest} messageEvaluationRequest Specifies the kind of transaction | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
async evaluateMessage(messageEvaluationRequest: MessageEvaluationRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<MessageEvaluationResponse>> { | ||
const localVarAxiosArgs = await localVarAxiosParamCreator.evaluateMessage(messageEvaluationRequest, options); | ||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||
}, | ||
/** | ||
* Get an evm message by id | ||
* @summary Info for a specific evm message | ||
* @param {string} messageID The id of the evm message | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
async getMessageByID(messageID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EVMMessage>> { | ||
const localVarAxiosArgs = await localVarAxiosParamCreator.getMessageByID(messageID, options); | ||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); | ||
}, | ||
} | ||
}; | ||
|
||
/** | ||
* MessagesApi - factory interface | ||
* @export | ||
*/ | ||
export const MessagesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { | ||
const localVarFp = MessagesApiFp(configuration) | ||
return { | ||
/** | ||
* Approve a pending evm message | ||
* @summary Approve a pending evm message | ||
* @param {string} messageID id for the message | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
approvePendingMessage(messageID: string, options?: any): AxiosPromise<void> { | ||
return localVarFp.approvePendingMessage(messageID, options).then((request) => request(axios, basePath)); | ||
}, | ||
/** | ||
* Check if a given message is valid for EVM | ||
* @summary Evaluate an evm message to sign | ||
* @param {MessageEvaluationRequest} messageEvaluationRequest Specifies the kind of transaction | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
evaluateMessage(messageEvaluationRequest: MessageEvaluationRequest, options?: any): AxiosPromise<MessageEvaluationResponse> { | ||
return localVarFp.evaluateMessage(messageEvaluationRequest, options).then((request) => request(axios, basePath)); | ||
}, | ||
/** | ||
* Get an evm message by id | ||
* @summary Info for a specific evm message | ||
* @param {string} messageID The id of the evm message | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
getMessageByID(messageID: string, options?: any): AxiosPromise<EVMMessage> { | ||
return localVarFp.getMessageByID(messageID, options).then((request) => request(axios, basePath)); | ||
}, | ||
}; | ||
}; | ||
|
||
/** | ||
* Request parameters for approvePendingMessage operation in MessagesApi. | ||
* @export | ||
* @interface MessagesApiApprovePendingMessageRequest | ||
*/ | ||
export interface MessagesApiApprovePendingMessageRequest { | ||
/** | ||
* id for the message | ||
* @type {string} | ||
* @memberof MessagesApiApprovePendingMessage | ||
*/ | ||
readonly messageID: string | ||
} | ||
|
||
/** | ||
* Request parameters for evaluateMessage operation in MessagesApi. | ||
* @export | ||
* @interface MessagesApiEvaluateMessageRequest | ||
*/ | ||
export interface MessagesApiEvaluateMessageRequest { | ||
/** | ||
* Specifies the kind of transaction | ||
* @type {MessageEvaluationRequest} | ||
* @memberof MessagesApiEvaluateMessage | ||
*/ | ||
readonly messageEvaluationRequest: MessageEvaluationRequest | ||
} | ||
|
||
/** | ||
* Request parameters for getMessageByID operation in MessagesApi. | ||
* @export | ||
* @interface MessagesApiGetMessageByIDRequest | ||
*/ | ||
export interface MessagesApiGetMessageByIDRequest { | ||
/** | ||
* The id of the evm message | ||
* @type {string} | ||
* @memberof MessagesApiGetMessageByID | ||
*/ | ||
readonly messageID: string | ||
} | ||
|
||
/** | ||
* MessagesApi - object-oriented interface | ||
* @export | ||
* @class MessagesApi | ||
* @extends {BaseAPI} | ||
*/ | ||
export class MessagesApi extends BaseAPI { | ||
/** | ||
* Approve a pending evm message | ||
* @summary Approve a pending evm message | ||
* @param {MessagesApiApprovePendingMessageRequest} requestParameters Request parameters. | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
* @memberof MessagesApi | ||
*/ | ||
public approvePendingMessage(requestParameters: MessagesApiApprovePendingMessageRequest, options?: AxiosRequestConfig) { | ||
return MessagesApiFp(this.configuration).approvePendingMessage(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath)); | ||
} | ||
|
||
/** | ||
* Check if a given message is valid for EVM | ||
* @summary Evaluate an evm message to sign | ||
* @param {MessagesApiEvaluateMessageRequest} requestParameters Request parameters. | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
* @memberof MessagesApi | ||
*/ | ||
public evaluateMessage(requestParameters: MessagesApiEvaluateMessageRequest, options?: AxiosRequestConfig) { | ||
return MessagesApiFp(this.configuration).evaluateMessage(requestParameters.messageEvaluationRequest, options).then((request) => request(this.axios, this.basePath)); | ||
} | ||
|
||
/** | ||
* Get an evm message by id | ||
* @summary Info for a specific evm message | ||
* @param {MessagesApiGetMessageByIDRequest} requestParameters Request parameters. | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
* @memberof MessagesApi | ||
*/ | ||
public getMessageByID(requestParameters: MessagesApiGetMessageByIDRequest, options?: AxiosRequestConfig) { | ||
return MessagesApiFp(this.configuration).getMessageByID(requestParameters.messageID, options).then((request) => request(this.axios, this.basePath)); | ||
} | ||
} |
Oops, something went wrong.