Skip to content

Commit

Permalink
feat: Add Minting APIs to Blockchain Data package (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
allan-almeida-imtbl authored Feb 21, 2024
1 parent 9d97b21 commit d8fe557
Show file tree
Hide file tree
Showing 15 changed files with 1,278 additions and 3 deletions.
61 changes: 59 additions & 2 deletions packages/blockchain-data/sdk/src/blockchain-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { mr } from '@imtbl/generated-clients';
import { BlockchainDataConfiguration, BlockchainDataModuleConfiguration, } from './config';
import {
BlockchainDataConfiguration,
BlockchainDataModuleConfiguration,
} from './config';
import { formatError } from './utils/formatErrors';

export class BlockchainData {
Expand Down Expand Up @@ -55,7 +58,7 @@ export class BlockchainData {
* @throws {@link index.APIError}
*/
public async listActivityHistory(
request: mr.ActivitiesApiListActivityHistoryRequest
request: mr.ActivitiesApiListActivityHistoryRequest,
): Promise<mr.ListActivitiesResult> {
return await this.activities
.listActivityHistory(request)
Expand Down Expand Up @@ -218,6 +221,60 @@ export class BlockchainData {
});
}

/**
* Create a mint request to mint a set of NFTs for a given collection
* @experimental
* @param request - the request object containing the parameters to be provided in the API request
* @returns a promise that resolves with the remaining rate limits
* @throws {@link index.APIError}
*/
public async createMintRequest(
request: mr.NftsApiCreateMintRequestRequest,
): Promise<mr.CreateMintRequestResult> {
return await this.nfts
.createMintRequest(request)
.then((res) => res.data)
.catch((err) => {
throw formatError(err);
});
}

/**
* List all mint requests for a given contract address
* @experimental
* @param request - the request object containing the parameters to be provided in the API request
* @returns a promise that resolves with a list of mint requests
* @throws {@link index.APIError}
*/
public async listMintRequests(
request: mr.NftsApiListMintRequestsRequest,
): Promise<mr.ListMintRequestsResult> {
return await this.nfts
.listMintRequests(request)
.then((res) => res.data)
.catch((err) => {
throw formatError(err);
});
}

/**
* Retrieve the status of a single mint request identified by its reference ID
* @experimental
* @param request - the request object containing the parameters to be provided in the API request
* @returns a promise that resolves with a single mint request
* @throws {@link index.APIError}
*/
public async getMintRequest(
request: mr.NftsApiGetMintRequestRequest,
): Promise<mr.ListMintRequestsResult> {
return await this.nfts
.getMintRequest(request)
.then((res) => res.data)
.catch((err) => {
throw formatError(err);
});
}

/**
* List NFT owners by token ID
* @param request - the request object containing the parameters to be provided in the API request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ models/create-counterfactual-address-request.ts
models/create-counterfactual-address-res-deprecated.ts
models/create-counterfactual-address-res.ts
models/create-listing-request-body.ts
models/create-mint-request-request.ts
models/create-mint-request-result.ts
models/deposit.ts
models/erc1155-item.ts
models/erc20-item.ts
Expand Down Expand Up @@ -86,6 +88,7 @@ models/list-collection-owners-result.ts
models/list-collections-result.ts
models/list-listings-result.ts
models/list-metadata-result.ts
models/list-mint-requests-result.ts
models/list-nftowners-result.ts
models/list-nfts-by-owner-result.ts
models/list-nfts-result.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,111 @@
// @ts-ignore
import { APIError400 } from '../models';
// @ts-ignore
import { APIError401 } from '../models';
// @ts-ignore
import { APIError403 } from '../models';
// @ts-ignore
import { APIError404 } from '../models';
// @ts-ignore
import { APIError429 } from '../models';
// @ts-ignore
import { APIError500 } from '../models';
// @ts-ignore
import { CreateMintRequestRequest } from '../models';
// @ts-ignore
import { CreateMintRequestResult } from '../models';
// @ts-ignore
import { GetNFTResult } from '../models';
// @ts-ignore
import { ListMintRequestsResult } from '../models';
// @ts-ignore
import { ListNFTsByOwnerResult } from '../models';
// @ts-ignore
import { ListNFTsResult } from '../models';
// @ts-ignore
import { MintRequestStatus } from '../models';
// @ts-ignore
export { APIError400 } from '../models';
// @ts-ignore
export { APIError401 } from '../models';
// @ts-ignore
export { APIError403 } from '../models';
// @ts-ignore
export { APIError404 } from '../models';
// @ts-ignore
export { APIError429 } from '../models';
// @ts-ignore
export { APIError500 } from '../models';
// @ts-ignore
export { CreateMintRequestRequest } from '../models';
// @ts-ignore
export { CreateMintRequestResult } from '../models';
// @ts-ignore
export { GetNFTResult } from '../models';
// @ts-ignore
export { ListMintRequestsResult } from '../models';
// @ts-ignore
export { ListNFTsByOwnerResult } from '../models';
// @ts-ignore
export { ListNFTsResult } from '../models';
// @ts-ignore
export { MintRequestStatus } from '../models';

/**
* Request parameters for createMintRequest operation in NftsApi.
* @export
* @interface CreateMintRequestRequest
*/
export interface CreateMintRequestRequestParams {
/**
* The address of contract
* @type {string}
* @memberof CreateMintRequest
*/
readonly contractAddress: string

/**
* The name of chain
* @type {string}
* @memberof CreateMintRequest
*/
readonly chainName: string

/**
* the request body
* @type {CreateMintRequestRequest}
* @memberof CreateMintRequest
*/
readonly createMintRequestRequest: CreateMintRequestRequest
}

/**
* Request parameters for getMintRequest operation in NftsApi.
* @export
* @interface GetMintRequestRequest
*/
export interface GetMintRequestRequestParams {
/**
* The address of contract
* @type {string}
* @memberof GetMintRequest
*/
readonly contractAddress: string

/**
* The name of chain
* @type {string}
* @memberof GetMintRequest
*/
readonly chainName: string

/**
* The ID of the mint request
* @type {string}
* @memberof GetMintRequest
*/
readonly referenceId: string
}

/**
* Request parameters for getNFT operation in NftsApi.
Expand Down Expand Up @@ -101,6 +185,48 @@ export interface ListAllNFTsRequestParams {
readonly pageSize?: number
}

/**
* Request parameters for listMintRequests operation in NftsApi.
* @export
* @interface ListMintRequestsRequest
*/
export interface ListMintRequestsRequestParams {
/**
* The address of contract
* @type {string}
* @memberof ListMintRequests
*/
readonly contractAddress: string

/**
* The name of chain
* @type {string}
* @memberof ListMintRequests
*/
readonly chainName: string

/**
* Encoded page cursor to retrieve previous or next page. Use the value returned in the response.
* @type {string}
* @memberof ListMintRequests
*/
readonly pageCursor?: string

/**
* Maximum number of items to return
* @type {number}
* @memberof ListMintRequests
*/
readonly pageSize?: number

/**
* The status of the mint request
* @type {MintRequestStatus}
* @memberof ListMintRequests
*/
readonly status?: MintRequestStatus
}

/**
* Request parameters for listNFTs operation in NftsApi.
* @export
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* tslint:disable */
/* eslint-disable */
/**
* Immutable zkEVM API
* Immutable Multi Rollup API
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


// May contain unused imports in some cases
// @ts-ignore
import { MintAsset } from './mint-asset';

/**
*
* @export
* @interface CreateMintRequestRequest
*/
export interface CreateMintRequestRequest {
/**
* List of nft to be minted
* @type {Array<MintAsset>}
* @memberof CreateMintRequestRequest
*/
'assets': Array<MintAsset>;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* tslint:disable */
/* eslint-disable */
/**
* Immutable zkEVM API
* Immutable Multi Rollup API
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/



/**
*
* @export
* @interface CreateMintRequestResult
*/
export interface CreateMintRequestResult {
/**
*
* @type {string}
* @memberof CreateMintRequestResult
*/
'imx_mint_requests_limit': string;
/**
*
* @type {string}
* @memberof CreateMintRequestResult
*/
'imx_mint_requests_limit_reset': string;
/**
*
* @type {string}
* @memberof CreateMintRequestResult
*/
'imx_remaining_mint_requests': string;
/**
*
* @type {string}
* @memberof CreateMintRequestResult
*/
'imx_mint_requests_retry_after': string;
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export * from './chain-with-details-all-of';
export * from './collection';
export * from './collection-contract-type';
export * from './collection-metadata';
export * from './create-mint-request-request';
export * from './create-mint-request-result';
export * from './deposit';
export * from './erc1155-item';
export * from './erc20-item';
Expand All @@ -45,6 +47,7 @@ export * from './list-chains-result';
export * from './list-collection-owners-result';
export * from './list-collections-result';
export * from './list-metadata-result';
export * from './list-mint-requests-result';
export * from './list-nftowners-result';
export * from './list-nfts-by-owner-result';
export * from './list-nfts-result';
Expand Down
Loading

0 comments on commit d8fe557

Please sign in to comment.