import { AssetStatus, AssetType, AnimationType } from "./AssetTypes";
import { TransactionPagingDetails, TransactionStatus, TransactionType } from "./TransactionTypes";
/**
* @summary Fee type support in Myria System (ROYALTY)
* @typedef {enum} FeeType
*
*/
export enum FeeType {
ROYALTY = 'ROYALTY',
// TAKER = 'TAKER',
// MAKER = 'MAKER',
// PROTOCOL = 'PROTOCOL',
}
/**
* @typedef {Object} FeeData
* @property {number} fees.percentage The number percentage fee for the asset which cost x% price of the listing assets
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
* @property {number} fees.receiptAddress The recipient address where the fee is going to on the purchased transaction
* @property {string?} fees.feeType The optional fee type of the NFT (MINTABLE_ERC721)
*/
export interface FeeData {
percentage: number;
receiptAddress: string;
feeType?: FeeType;
}
/**
* @typedef {Object} MintERC721Params
* @property {string} requestId Unique request ID for mint transaction
* @property {string} partnerRefId Unique project ID for partner in Myria system
* @property {string} requestDescription Description of the minting action
* @property {string} starkKey Unique public stark key of the user who owns Project/Collection/Nfts
* @property {string} contractAddress Unique smart contract address of the collection
* @property {string} uri The base metadata uri endpoint where assets metadata file is located
* @property {string} tokenId Unique token ID of the NFT in one collection
* @property {string} description Description details about the assets NFTs (which is shown on Myria marketplace)
* @property {FeeData[]} fees The optional royalty fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
*/
export interface MintERC721Params {
requestId: string;
partnerRefId: string; // Project ID
requestDescription: string;
starkKey: string;
contractAddress: string;
uri: string;
tokenId: string;
description?: string;
fees: FeeData[];
}
/**
* @typedef {Object} TransactionResponse
* @property {number} transactionId The unique sequence ID of the transaction
* @property {string=} assetType The unique sequence ID of the transaction
* @property {string} starkKey The stark key of the operator for the transaction
* @property {number} vaultId The unique vaultID to store the fund of the assets
* @property {TransactionType} transactionType Transaction type (DepositRequest/WithdrawalRequest/...)
* @property {TransactionStatus} transactionStatus Transaction status (Prepare / FailedGateway / Pending / Success / Failed)
* @property {string} quantizedAmount The quantized amount of tokens in the transaction
* + If token type is NFT (ERC721, MINTABLE_ERC721), quantizedAmount should always be 1
* + If token type is ETH / ERC20 (ERC20, MINTABLE_ERC20)
* + 1 - Converter for Quantized Amount: It is calculated based on standard rule: (amount * 10^18) / 10 ^ 10
* + 2 - The calculate rule is convert the pure amount of token to WEI (10^10), then devide it by 10^10 (QUANTUM number defined in platform)
* @property {number} createdAt The created time of the transaction
* @property {number=} updatedAt THe last updated time of the transaction
* @property {string=} assetId The hex string for the asset ID for the transaction
*/
export interface TransactionResponse {
transactionId: number;
assetType?: string;
starkKey: string;
vaultId: number;
transactionType: TransactionType;
transactionStatus: TransactionStatus;
quantizedAmount: string;
createdAt: number;
updatedAt?: number;
assetId?: string;
}
/**
* @typedef {Object} MintAssetErc721Info
* @property {string} tokenId The unique token ID of the Asset NFT
* @property {string} description The description of the Asset NFT (ERC721 / MINTABLE_ERC721)
* @property {FeeData[]?} fees The fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
* @property {string?} mintForStarkKey The recipients of stark key to mint directly to end-users/stark-key
* @property {trackingId?} trackingId The tracking ID that developer can be putting on for keep track informations for specific information or transactions of NFTs
*/
export interface MintAssetErc721Info {
tokenId: string;
description: string;
fees?: FeeData[];
mintForStarkKey?: string;
trackingId?: string;
}
/**
* @typedef {Object} MintAssetErc721InfoAsync
* @property {string} tokenId The unique token ID of the Asset NFT
* @property {string} description The description of the Asset NFT (ERC721 / MINTABLE_ERC721)
* @property {FeeData[]?} fees The fee data (percentage, receipt address and feeType)
* @property {string?} mintForStarkKey The starkKey of user need mint for asset
* @property {string} trackingId The fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
*/
export interface MintAssetErc721InfoAsync {
tokenId: string;
description: string;
fees?: FeeData[];
mintForStarkKey?: string;
trackingId: string;
}
/**
* @typedef {Object} BulkMintERC721Params
* @property {string} starkKey The stark key of the owner who mint the assets
* @property {string} contractAddress The unique smart contract address of the collection
* @property {MintAssetErc721Info[]} assets List of minted asset request data
* @property {boolean} isSupportGetBulkMetadata The flag to enable for getting bulk metadata (Should always be true)
* @property {FeeData[]?} fees The fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
*/
export interface BulkMintERC721Params {
starkKey: string;
contractAddress: string;
assets: MintAssetErc721Info[];
isSupportGetBulkMetadata: boolean;
fees?: FeeData[];
}
/**
* @typedef {Object} BulkMintQueueAsyncParamsAPI
* @property {string} requestId Unique request ID to query the minting batch contains the list of minted assets
* @property {string} partnerRefId Project ID that developer or partners mint NFTs inside
* @property {string} groupRequestId Unique group request ID and it contains multiple request IDs for bulk mint async and we can use this field for re-query the list of minted transactions later on
* @property {string} requestDescription The details description for minting request that the partner/developer can put into for tracking and mapping in their system
* @property {string} accountId The Myria user ID (unique and identical for account) - Partner/Developer can find it in the Dev Portal
* @property {number} collectionId The ID of collection that NFTs will be mint under
* @property {MintAssetErc721Info[]} assets List of minted asset request data
* @property {boolean} isSupportGetBulkMetadata The flag to enable for getting bulk metadata (Should always be true)
* @property {FeeData[]?} fees The fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
*/
export interface BulkMintQueueAsyncParamsAPI {
requestId: string;
partnerRefId: string;
groupRequestId: string;
requestDescription: string;
accountId: string;
collectionId: number;
assets: MintAssetErc721InfoAsync[];
isSupportGetBulkMetadata: boolean;
fees?: FeeData[];
}
/**
* @typedef {Object} BulkMintQueueAsyncParams
* @property {string} apiKey Partner or Developer API key - which can be generate in the Developer Portal
* @property {string} requestId Unique request ID to query the minting batch contains the list of minted assets
* @property {string} partnerRefId Project ID that developer or partners mint NFTs inside
* @property {string} groupRequestId Unique group request ID and it contains multiple request IDs for bulk mint async and we can use this field for re-query the list of minted transactions later on
* @property {string} requestDescription The details description for minting request that the partner/developer can put into for tracking and mapping in their system
* @property {string} accountId The Myria user ID (unique and identical for account) - Partner/Developer can find it in the Dev Portal
* @property {number} collectionId The ID of collection that NFTs will be mint under
* @property {MintAssetErc721Info[]} assets List of minted asset request data
* @property {boolean} isSupportGetBulkMetadata The flag to enable for getting bulk metadata (Default is false, only true if the metadata server support retrieve NFTs as the batch)
* @property {FeeData[]?} fees The fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
*/
export interface BulkMintQueueAsyncParams extends BulkMintQueueAsyncParamsAPI {
apiKey: string
}
/**
* @typedef {Object} QueryMintingParams
* @property {string} partnerRefId Project ID that developer or partners mint NFTs inside
* @property {string} groupRequestId Unique group request ID and it contains multiple request IDs for bulk mint async and we can use this field for re-query the list of minted transactions later on
* @property {string} developerApiKey Partner or Developer API key - which can be generate in the Developer Portal
* @param {TransactionPagingDetails=} transactionPaging The pagination params (which included starkKey, limit, createdAt, transactionCategory for query next page)
*/
export interface QueryMintingParams {
partnerRefId: string;
groupRequestId: string;
developerApiKey: string;
transactionPaging?: TransactionPagingDetails;
}
export interface QueryMintedAsset {
id: number;
status: string;
tokenId: string;
assetType: string;
tokenAddress: string;
starkKey: string;
assetMintId: string;
name: string;
creatorStarkKey: string;
isListing: boolean;
}
export interface QueryMintingResponse {
items: QueryMintedAsset[];
lastEvaluatedKey: TransactionPagingDetails;
}
/**
* @typedef {Object} BulkMintQueueParams
* @property {string} apiKey Partner or Developer API key - which can be generate in the Developer Portal
* @property {string} requestId Unique request ID to query the minting batch contains the list of minted assets
* @property {string} partnerRefId Project ID that developer or partners mint NFTs inside
* @property {string} groupRequestId Unique group request ID and it contains multiple request IDs for bulk mint async and we can use this field for re-query the list of minted transactions later on
* @property {string} requestDescription The details description for minting request that the partner/developer can put into for tracking and mapping in their system
* @property {string} accountId The Myria user ID (unique and identical for account) - Partner/Developer can find it in the Dev Portal
* @property {number} collectionId The ID of collection that NFTs will be mint under
* @property {MintAssetErc721Info[]} assets List of minted asset request data
* @property {boolean} isSupportGetBulkMetadata The flag to enable for getting bulk metadata (Default is false, only true if the metadata server support retrieve NFTs as the batch)
* @property {FeeData[]?} fees The fee data (percentage, receipt address and feeType)
* + For example, if the percentage is 5:
* + For every purchased transaction, if seller (non-creator) would receive 95% of listing price, (creator) would receive 5%
* + In case of the seller is the creator, seller/creator would receive the full 100% of listing price
*/
export interface BulkMintQueueParams extends BulkMintQueueAsyncParamsAPI {
apiKey: string
}
/**
* @typedef {Object} BulkMintERC721Response
* @property {string} status Http status code
* @property {BulkMintERC721ResponseData} data Details bulk mint transaction data
*/
export interface BulkMintERC721Response {
status: string;
data: BulkMintERC721ResponseData;
}
/**
* @typedef {Object} BulkMintERC721ResponseData
* @property {MintedAssetResponse[]} mintedAssets List of the minted successfully assets
* @property {MintedAssetResponse[]} failedMintingAsset List of assets that have failed for some reasons validation or internal errors(validation, server error)
* @property {any[]} failedAssets List of assets that have failed (Fetch metadata, asset existed)
*/
export interface BulkMintERC721ResponseData {
mintedAssets: MintedAssetResponse[];
failedMintingAsset: MintedAssetResponse[];
failedAssets: Record<string, any>[];
}
/**
* @typedef {Object} BulkMintERC721AsyncResponse
* @property {string} status Http status code
* @property {BulkMintQueueAsyncResponseData} data Details bulk mint transaction data
*/
export interface BulkMintQueueAsyncResponse {
status: string;
data: BulkMintQueueAsyncResponseData;
}
/**
* @typedef {Object} BulkMintQueueAsyncResponseData
* @property {string} requestId Unique request ID to query the minting batch contains the list of minted assets
* @property {string} groupRequestId Unique group request ID and it contains multiple request IDs for bulk mint async and we can use this field for re-query the list of minted transactions later on
* @property {MintedAssetResponse[]} validItems List of validated assets and being mint in system at background
* @property {any[]} invalidItems List of invalid NFTs info - Partner/developer need checks with details invalid NFT info
*/
export interface BulkMintQueueAsyncResponseData {
requestId: string;
groupRequestId: string;
validItems: MintedAssetResponse[];
invalidItems: Record<string, any>[];
}
/**
* @typedef {Object} MintedAssetResponse
* @property {number} id The asset ID in Marketplace
* @property {string} starkKey Owner stark key of the asset
* @property {string} uri Metadata uri for the assets (NFT / ERC721)
* @property {string} assetType Token type of the asset (ERC721 / MINTABLE_ERC721 / ERC20 / MINTABLE_ERC20)
* @property {number} tokenId Unique token id of the asset NFT (ERC721 / MINTABLE_ERC721)
* @property {string} tokenAddress Token address
* @property {string} status Status of the NFT/Asset (MINTED / MINT_FAILED)
* @property {string=} name Name of the asset
* @property {string=} description Description about the asset NFT
* @property {string=} imageUrl Represented image for the NFTs/ asset
* @property {string=} animationUrl Represented image/video for the NFTs/ asset
* @property {AnimationType=} animationUrlMimeType Represented image/video for the NFTs/ asset
* @property {number} collectionId Id of the collection where asset resides
* @property {Record<string, any>} metadata Metadata of the NFT
* @property {Record<string, any>=} metadataOptional Metadata optional with extra field beyond schema metadata's format of the NFT
* @property {string} creatorStarkKey Stark key of the creator who own the asset
* @property {string} publicId The unique public ID (UUID) of the asset
* @property {string=} assetMintId The hex string of the asset to map with the on-chain data
* @property {number=} transactionId The unique sequence transaction ID
*/
export interface MintedAssetResponse {
id: number;
starkKey: string;
uri: string;
assetType: AssetType;
tokenId: string;
tokenAddress: string;
status: AssetStatus;
name?: string;
description?: string;
imageUrl?: string;
animationUrl?: string;
animationUrlMimeType?: AnimationType;
collectionId: number;
metadata: Record<string, any>;
metadataOptional?: Record<string, any>;
creatorStarkKey: string;
publicId: string;
assetMintId?: string;
transactionId?: number;
}
/**
* @typedef {Object} MintERC721Response
* @property {string} status Http status code (200 / 400 / 500)
* @property {MintedAssetResponse} data.asset Asset NFT's data response (details information of the assets)
* @property {TransactionResponse} data.transaction Details transaction information (transactionId / transactionType / quanizedAmount /...etc..)
*/
export interface MintERC721Response {
status: string;
data: {
asset: MintedAssetResponse;
transaction: TransactionResponse;
message: string;
};
}
/**
* @typedef {Object} MintedAssetType
*
*/
export interface MintedAssetType {
blueprint: string,
tokenId: string,
assetId: string,
contractAddress: string,
transactionId: number,
starkKey: string,
status: string
}
export interface MintERC20Params {
starkKey: string;
contractAddress: string;
uri: string;
tokenId: string;
description?: string;
royalties: [
{
percentage: number;
receiptAddress: string;
}
];
quantum: string;
quantizedAmount: string;
}
export interface MintERC20Response {
status: string;
data: any;
}
export interface GetMintedTransactionParams {
transactionId: number;
}
/**
* @typedef {Object} GetMintedTransactionResponse
* @property {string} status Http status of the request
* @property {TransactionResponse} data Details of transaction response data
*/
export interface GetMintedTransactionResponse {
status: string;
data: TransactionResponse;
}
export interface GetMintedAssetsParams {
starkKey: string;
}
export interface GetMintedAssetsResponse {
status: string;
}
Source