Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

TD-1271: feat: primary sales rejection flow #427

Merged
merged 4 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,652 changes: 1,337 additions & 315 deletions openapi.json

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion src/ImmutableX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ export class ImmutableX {
* Accept a PrimarySale
* @param ethSigner - eth signer matching the 'studio_ether_key' of the primary sale
* @param primarySaleId - id of the primary sale accepting
* @returns a promise that resolves with the created Trade
* @returns a promise that resolves with the accepted PrimarySale
* @throws {@link index.IMXError}
*/
public acceptPrimarySale(ethSigner: EthSigner, primarySaleId: number) {
Expand All @@ -985,4 +985,19 @@ export class ImmutableX {
throw formatError(err);
});
}

/**
* Reject a PrimarySale
* @param ethSigner - eth signer matching the 'studio_ether_key' of the primary sale
* @param primarySaleId - id of the primary sale to be rejected
* @returns a promise that resolves with the rejected PrimarySale
* @throws {@link index.IMXError}
*/
public rejectPrimarySale(ethSigner: EthSigner, primarySaleId: number) {
return this.workflows
.rejectPrimarySale(ethSigner, primarySaleId)
.catch(err => {
throw formatError(err);
});
}
}
40 changes: 40 additions & 0 deletions src/api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,30 @@ models/register-passport-user-request.ts
models/register-passport-user-result.ts
models/register-user-request.ts
models/register-user-response.ts
models/reject-primary-sale-bad-request-body-all-of0.ts
models/reject-primary-sale-bad-request-body-all-of1.ts
models/reject-primary-sale-bad-request-body.ts
models/reject-primary-sale-forbidden-body-all-of0.ts
models/reject-primary-sale-forbidden-body-all-of1.ts
models/reject-primary-sale-forbidden-body.ts
models/reject-primary-sale-internal-server-error-body-all-of0.ts
models/reject-primary-sale-internal-server-error-body-all-of1.ts
models/reject-primary-sale-internal-server-error-body.ts
models/reject-primary-sale-not-found-body-all-of0.ts
models/reject-primary-sale-not-found-body-all-of1.ts
models/reject-primary-sale-not-found-body.ts
models/reject-primary-sale-not-implemented-body-all-of0.ts
models/reject-primary-sale-not-implemented-body-all-of1.ts
models/reject-primary-sale-not-implemented-body.ts
models/reject-primary-sale-okbody-result-fees-items.ts
models/reject-primary-sale-okbody-result.ts
models/reject-primary-sale-okbody.ts
models/reject-primary-sale-unauthorized-body-all-of0.ts
models/reject-primary-sale-unauthorized-body-all-of1.ts
models/reject-primary-sale-unauthorized-body.ts
models/reject-primary-sale-unprocessable-entity-body-all-of0.ts
models/reject-primary-sale-unprocessable-entity-body-all-of1.ts
models/reject-primary-sale-unprocessable-entity-body.ts
models/signable-accept-primary-sale-bad-request-body-all-of0.ts
models/signable-accept-primary-sale-bad-request-body-all-of1.ts
models/signable-accept-primary-sale-bad-request-body.ts
Expand Down Expand Up @@ -317,6 +341,22 @@ models/signable-create-primary-sale-okbody-fees-items.ts
models/signable-create-primary-sale-okbody.ts
models/signable-create-primary-sale-params-body-fees-items.ts
models/signable-create-primary-sale-params-body.ts
models/signable-reject-primary-sale-bad-request-body-all-of0.ts
models/signable-reject-primary-sale-bad-request-body-all-of1.ts
models/signable-reject-primary-sale-bad-request-body.ts
models/signable-reject-primary-sale-internal-server-error-body-all-of0.ts
models/signable-reject-primary-sale-internal-server-error-body-all-of1.ts
models/signable-reject-primary-sale-internal-server-error-body.ts
models/signable-reject-primary-sale-not-found-body-all-of0.ts
models/signable-reject-primary-sale-not-found-body-all-of1.ts
models/signable-reject-primary-sale-not-found-body.ts
models/signable-reject-primary-sale-not-implemented-body-all-of0.ts
models/signable-reject-primary-sale-not-implemented-body-all-of1.ts
models/signable-reject-primary-sale-not-implemented-body.ts
models/signable-reject-primary-sale-okbody.ts
models/signable-reject-primary-sale-unprocessable-entity-body-all-of0.ts
models/signable-reject-primary-sale-unprocessable-entity-body-all-of1.ts
models/signable-reject-primary-sale-unprocessable-entity-body.ts
models/signable-token.ts
models/signable-transfer-details-token.ts
models/signable-transfer-details-v2-token.ts
Expand Down
196 changes: 196 additions & 0 deletions src/api/domain/primary-sales-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ import { GetPrimarySaleNotImplementedBody } from '../models';
// @ts-ignore
import { GetPrimarySaleOKBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleBadRequestBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleForbiddenBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleInternalServerErrorBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleNotFoundBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleNotImplementedBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleOKBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleUnauthorizedBody } from '../models';
// @ts-ignore
import { RejectPrimarySaleUnprocessableEntityBody } from '../models';
// @ts-ignore
import { SignableAcceptPrimarySaleBadRequestBody } from '../models';
// @ts-ignore
import { SignableAcceptPrimarySaleInternalServerErrorBody } from '../models';
Expand All @@ -86,6 +102,18 @@ import { SignableCreatePrimarySaleNotImplementedBody } from '../models';
import { SignableCreatePrimarySaleOKBody } from '../models';
// @ts-ignore
import { SignableCreatePrimarySaleParamsBody } from '../models';
// @ts-ignore
import { SignableRejectPrimarySaleBadRequestBody } from '../models';
// @ts-ignore
import { SignableRejectPrimarySaleInternalServerErrorBody } from '../models';
// @ts-ignore
import { SignableRejectPrimarySaleNotFoundBody } from '../models';
// @ts-ignore
import { SignableRejectPrimarySaleNotImplementedBody } from '../models';
// @ts-ignore
import { SignableRejectPrimarySaleOKBody } from '../models';
// @ts-ignore
import { SignableRejectPrimarySaleUnprocessableEntityBody } from '../models';
/**
* PrimarySalesApi - axios parameter creator
* @export
Expand Down Expand Up @@ -197,6 +225,46 @@ export const PrimarySalesApiAxiosParamCreator = function (configuration?: Config



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* [Experimental] Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Reject Primary Sale
* @param {number} id Global Primary Sale identifier
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
rejectPrimarySale: async (id: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('rejectPrimarySale', 'id', id)
const localVarPath = `/v1/primary_sales/{id}/reject`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// 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 ImxEthAddress required
await setApiKeyToObject(localVarHeaderParameter, "x-imx-eth-address", configuration)

// authentication ImxEthSignature required
await setApiKeyToObject(localVarHeaderParameter, "x-imx-eth-signature", configuration)



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
Expand Down Expand Up @@ -269,6 +337,40 @@ export const PrimarySalesApiAxiosParamCreator = function (configuration?: Config
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* [Experimental] Signable Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Reject Primary Sale
* @param {number} id Global Primary Sale identifier
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
signableRejectPrimarySale: async (id: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('signableRejectPrimarySale', 'id', id)
const localVarPath = `/v1/primary_sales/{id}/signable-reject-details`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// 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;



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
Expand Down Expand Up @@ -317,6 +419,17 @@ export const PrimarySalesApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.getPrimarySale(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* [Experimental] Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Reject Primary Sale
* @param {number} id Global Primary Sale identifier
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async rejectPrimarySale(id: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RejectPrimarySaleOKBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.rejectPrimarySale(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* [Experimental] Signable Accept Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Accept Primary Sale
Expand All @@ -339,6 +452,17 @@ export const PrimarySalesApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.signableCreatePrimarySale(body, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* [Experimental] Signable Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Reject Primary Sale
* @param {number} id Global Primary Sale identifier
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async signableRejectPrimarySale(id: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SignableRejectPrimarySaleOKBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.signableRejectPrimarySale(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
}
};

Expand Down Expand Up @@ -379,6 +503,16 @@ export const PrimarySalesApiFactory = function (configuration?: Configuration, b
getPrimarySale(id: number, options?: any): AxiosPromise<GetPrimarySaleOKBody> {
return localVarFp.getPrimarySale(id, options).then((request) => request(axios, basePath));
},
/**
* [Experimental] Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Reject Primary Sale
* @param {number} id Global Primary Sale identifier
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
rejectPrimarySale(id: number, options?: any): AxiosPromise<RejectPrimarySaleOKBody> {
return localVarFp.rejectPrimarySale(id, options).then((request) => request(axios, basePath));
},
/**
* [Experimental] Signable Accept Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Accept Primary Sale
Expand All @@ -399,6 +533,16 @@ export const PrimarySalesApiFactory = function (configuration?: Configuration, b
signableCreatePrimarySale(body?: SignableCreatePrimarySaleParamsBody, options?: any): AxiosPromise<SignableCreatePrimarySaleOKBody> {
return localVarFp.signableCreatePrimarySale(body, options).then((request) => request(axios, basePath));
},
/**
* [Experimental] Signable Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Reject Primary Sale
* @param {number} id Global Primary Sale identifier
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
signableRejectPrimarySale(id: number, options?: any): AxiosPromise<SignableRejectPrimarySaleOKBody> {
return localVarFp.signableRejectPrimarySale(id, options).then((request) => request(axios, basePath));
},
};
};

Expand Down Expand Up @@ -444,6 +588,20 @@ export interface PrimarySalesApiGetPrimarySaleRequest {
readonly id: number
}

/**
* Request parameters for rejectPrimarySale operation in PrimarySalesApi.
* @export
* @interface PrimarySalesApiRejectPrimarySaleRequest
*/
export interface PrimarySalesApiRejectPrimarySaleRequest {
/**
* Global Primary Sale identifier
* @type {number}
* @memberof PrimarySalesApiRejectPrimarySale
*/
readonly id: number
}

/**
* Request parameters for signableAcceptPrimarySale operation in PrimarySalesApi.
* @export
Expand Down Expand Up @@ -472,6 +630,20 @@ export interface PrimarySalesApiSignableCreatePrimarySaleRequest {
readonly body?: SignableCreatePrimarySaleParamsBody
}

/**
* Request parameters for signableRejectPrimarySale operation in PrimarySalesApi.
* @export
* @interface PrimarySalesApiSignableRejectPrimarySaleRequest
*/
export interface PrimarySalesApiSignableRejectPrimarySaleRequest {
/**
* Global Primary Sale identifier
* @type {number}
* @memberof PrimarySalesApiSignableRejectPrimarySale
*/
readonly id: number
}

/**
* PrimarySalesApi - object-oriented interface
* @export
Expand Down Expand Up @@ -515,6 +687,18 @@ export class PrimarySalesApi extends BaseAPI {
return PrimarySalesApiFp(this.configuration).getPrimarySale(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
}

/**
* [Experimental] Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Reject Primary Sale
* @param {PrimarySalesApiRejectPrimarySaleRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PrimarySalesApi
*/
public rejectPrimarySale(requestParameters: PrimarySalesApiRejectPrimarySaleRequest, options?: AxiosRequestConfig) {
return PrimarySalesApiFp(this.configuration).rejectPrimarySale(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
}

/**
* [Experimental] Signable Accept Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Accept Primary Sale
Expand All @@ -538,4 +722,16 @@ export class PrimarySalesApi extends BaseAPI {
public signableCreatePrimarySale(requestParameters: PrimarySalesApiSignableCreatePrimarySaleRequest = {}, options?: AxiosRequestConfig) {
return PrimarySalesApiFp(this.configuration).signableCreatePrimarySale(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
}

/**
* [Experimental] Signable Reject Primary Sale. This endpoint is experimental and may change in the future.
* @summary [Experimental] Signable Reject Primary Sale
* @param {PrimarySalesApiSignableRejectPrimarySaleRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PrimarySalesApi
*/
public signableRejectPrimarySale(requestParameters: PrimarySalesApiSignableRejectPrimarySaleRequest, options?: AxiosRequestConfig) {
return PrimarySalesApiFp(this.configuration).signableRejectPrimarySale(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
}
}
Loading
Loading