import { CollectionTypes } from "./CollectionTypes";
import { PagingDataParams, TokenType } from "./CommonTypes";
import { AssetOrderBy } from "./OrderTypes";
import { ProjectResponseData } from "./ProjectTypes";
/**
* @typedef {string} OrderBuy sorting option for order buy
*/
/**
* @enum {OrderBuy} OrderBuy Sort enum for the order list by ASC/ DESC
*/
export enum OrderBuy {
ASC = "ASC",
DESC = "DESC",
}
// /**
// * @deprecated
// * @typedef {AssetParams} AssetParams~Request
// * @property {string} StarkKey key owner of of the assets
// * @property {string} MetadataURL Url of metadata to retrieve the metadata for NFTs
// * @property {string} MetadataURL Url of metadata to retrieve the metadata for NFTs
// */
export interface AssetParams {
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name?: string;
imageUrl?: string;
animationUrl?: string;
description?: string;
animationUrlMimeType?: string;
collectionId: number;
}
// /**
// * @typedef {Object} AssetResponse
// * @property {string} StarkKey Owner's stark key of the asset NFTs
// * @property {string} MetadataURL Url of metadata to retrieve the metadata for NFTs
// */
export interface AssetResponse {
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name: string;
imgUrl: string;
animationUrl: string;
description: string;
animationUrlMimeType: string;
collectionId: number;
updatedAt: string;
imageUrl: string | null;
assetMintId: string | null;
id: number;
createdAt: string;
metadata: Object | {};
publicId: string;
creatorStarkKey?: string | null;
transactionId?: string | null;
}
/**
* @typedef {Object} QueryAssetParamsByOwner
* @property {string} starkKey Stark key of collection owners for those assets
* @property {string} ownerWalletAddress Owner wallet address of the collection
* @property {number} collectionIds List of collections ID to get the assets belong to those collection
* @property {string} walletAddress Wallet address of player to get assets for this specific player
* - if wallet address is empty, by default it would get all of assets belong to all players
* @property {string=} page Page number of list items
* @property {limit=} limit Limit items per page for assets list
*/
export interface QueryAssetParamsByOwner {
starkKey: string;
ownerWalletAddress: string;
collectionIds: number[];
walletAddress?: string;
page?: number;
limit?: number;
}
export interface QueryAssetRequestAPIParams {
collectionIds: number[];
starkKey: string;
walletAddress?: string;
page?: number;
limit?: number;
}
/**
* @typedef {Object} OrderType
* @property {number} orderId The id of order
* @property {string} createdAt The created time of order
* @property {string} expiredAt The expired time of order
* @property {string} fees[].address The wallet address to receive the royalty fee
* @property {string} fees[].percentage The percentage of amount tokens that user will receive
* @property {boolean} includeFees The flag to identify the order including the fee or non-fee
* @property {string} assetIdSell The hex string of token sell
* @property {string} vaultIdSell The vault ID of the asset/token-sell
* @property {string} assetIdBuy The hex string of token buy
* @property {string} vaultIdBuy The vault ID of the asset/token-buy
* @property {string} amountSell The quantized amount (calculated amount) for sell tokens/assets
* @property {string} amountBuy The quantized amount (calculated amount) for buy tokens/assets
* @property {string} nonQuantizedAmountSell The original amount for selling (ex: 1 ETH/NFT non-quantized amount)
* @property {string} nonQuantizedAmountBuy The original amount for buying (ex: 0.1 ETH non-quantized amount)
*/
export interface OrderType {
orderId: number;
createdAt: string;
expiredAt: string;
status: string;
fees: {
address: string;
percentage: number;
}[];
includeFees: boolean;
assetIdSell: string;
vaultIdSell: number;
amountSell: string;
assetIdBuy: string;
vaultIdBuy: number;
nonQuantizedAmountSell: string;
nonQuantizedAmountBuy: string;
amountBuy: string;
price: number;
}
export interface AssetListResCollection extends CollectionTypes {
metadataSchema: any[];
project: ProjectResponseData;
__entity: string;
}
/**
* @typedef {enum} FeeTypes
* @property {number} id ID of fee on the database
* @property {string} address The wallet address to receive the fee
* @property {number} percentage The percentage of fee for purchased/traded transaction
* @property {string} feeType Type of FEE (currently support for ROYALTY only)
*/
export type FeeTypes = {
id: number;
address: string;
percentage: number;
feeType: string;
};
/**
* @typedef {Object} AssetDetailsResponse
* @property {number} id Unique id of assets as primary key
* @property {string} createdAt The created time when the assets/NFTs is created
* @property {string} updatedAt The updated time when the assets/NFTs is updated/traded
* @property {string} starkKey The stark key owner of the NFTs
* @property {string} uri The specific uri to point to metadata (off-chain data) of the assets/NFTs
* @property {string} assetType Token type of the assets (ERC721/MINTABLE_ERC721/ERC20/MINTABLE_ERC20)
* @property {number} tokenId Unique token id of the NFT
* @property {string} tokenAddress Token address with the pointed deployed smart contract address
* @property {string} status Status of the NFT/Asset (MINTED / MINT_FAILED)
* @property {string} name Name of the asset NFT
* @property {string} description Description about the NFT
* @property {string} imageUrl Represented image for the NFTs/ assets
* @property {number} collectionId Id of the collection own this asset
* @property {Object} metadata Metadata of the NFTs
* @property {Object} metadataOptional Metadata optional with extra field beyond schema metadata's format of the NFTs
* @property {string} owner.createdAt The time when the owner receive the NFTs as the NFTs get ownership's transfer
* @property {string} owner.ethAddress The wallet address (Metamask) of the owner
* @property {string} owner.starkKey The stark key of the owner
* @property {string} creator.name The name of creator NFTs
* @property {string} creator.starkKey The stark key of creator
* @property {string} publicId The unique public id (uuid) of the NFTs
* @property {string} assetMintId The hex string of the asset to map with the on-chain data
* @property {string} collectionName The name of collection
* @property {string} collectionContractAddress The smart contract address for the collection
* @property {FeeTypes[]} fee The fee type (including percentage, wallet-address, feeType..)
* @property {OrderType} order The order object to include the details information of price, assetId
* @property {number} totalMintedAssets The number of total minted assets in the same collection
*/
export interface AssetDetailsResponse {
id: number;
createdAt: string;
updatedAt: string;
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name: string;
description: string;
imageUrl: string;
animationUrl: null;
animationUrlMimeType: string;
collectionId: number;
metadata: MetadataTypes;
metadataOptional: {};
owner: {
createdAt: string;
ethAddress: string;
starkKey: string;
};
creator: {
name: string;
starkKey: string;
};
publicId: string;
assetMintId: string;
collectionName: string;
collectionContractAddress: string;
fee: FeeTypes[];
order: OrderType;
totalMintedAssets: number;
__entity: string;
}
export interface AssetVaultDetailsRequestAPI {
starkKey: string;
assetId: string;
}
export interface AssetVaultDetailsResponseAPI {
vaultId: number;
tokenName: string;
quantum: string;
id: string;
starkKey: string;
assetId: string;
assetType: string;
quantizedAmount: string;
createdAt: number;
updatedAt: number;
}
export interface AssetOwnerPublicKeyResponse { }
/**
* @typedef {Object} AssetStarkKeyResponse Asset data response
* @property {number} id Id of the specific assets NFT
* @property {string} createdAt Created time for the NFT
* @property {string} updatedAt Updated time for the NFT
* @property {string} starkKey Owner stark key of the NFT
* @property {string} uri Metadata uri for the NFT
* @property {string} assetType Token type of the assets (ERC721/MINTABLE_ERC721/ERC20/MINTABLE_ERC20)
* @property {number} tokenId Unique token id of the NFT
* @property {string} tokenAddress Token address with the pointed deployed smart contract address
* @property {string} status Status of the NFT/Asset (MINTED / MINT_FAILED)
* @property {string} name Name of the asset NFT
* @property {string} description Description about the NFT
* @property {string} imageUrl Represented image for the NFTs/ assets
* @property {number} collectionId Id of the collection own this asset
* @property {Object} metadata Metadata of the NFTs
* @property {Object} metadataOptional Metadata optional with extra field beyond schema metadata's format of the NFTs
* @property {string} assetMintId The hex string of the asset to map with the on-chain data
*/
export interface AssetStarkKeyResponse {
id: number;
createdAt: string;
updatedAt: string;
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name: string;
description: string;
imageUrl: string;
collectionId: number;
metadata: Object;
metadataOptional: Object;
assetMintId: string;
}
/**
* @typedef {Object} QueryAssetsWithCollectionResponse
* @property {CollectionTypes[]} collections List of returned collections in response
* @property {AssetStarkKeyResponse[]} items Asset/NFTs data
*/
export interface QueryAssetsWithCollectionResponse {
collections: CollectionTypes[];
items: AssetStarkKeyResponse[];
}
export interface Order {
id: number;
assetRefId: number;
amountSell: string | number;
amountBuy: string | number;
price: number;
ethusdRate: number;
nonQuantizedAmountSell: string;
nonQuantizedAmountBuy: string;
includeFees: boolean;
assetIdSell: string;
assetIdBuy: string;
vaultIdSell: number;
vaultIdBuy: number;
status: string;
expiredAt: string;
orderRequestId: string;
}
export interface AssetHaveOrderResponse {
id: number;
publicId: string;
name: string | null;
description: string;
collectionId: number;
uri: string;
imageUrl: string | null;
metadata: MetadataTypes;
owner: string;
order: Order[];
}
export interface AssetByCollectionIdResponse {
id: number;
name: string;
collectionImageUrl: string;
description: string;
iconUrl: string;
contractAddress: string;
ownerPublicKey: string;
metadataApiUrl: string;
starkKey: string;
publicId: string;
isHot: boolean;
metadataSchema: [];
createdAt: string;
updatedAt: string;
project: {
id: number;
name: string;
companyName: string;
contactEmail: string;
publicId: string;
};
totalAssets: number;
totalAssetsForSale: number;
}
export interface AssetDetailsResponseData {
id: number;
createdAt: string;
updatedAt: string;
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name: string;
imageUrl: string;
description: string;
collectionId: number;
metadata: {
name: string;
animationUrl: string;
animationUrlMimeType: string;
imageUrl: string;
attack: number;
collectable: boolean;
god: string;
element: string;
product: number;
rarity: number;
type: number;
};
publicId: string;
animationUrl: string;
animationUrlMimeType: string;
assetMintId: string;
}
export interface UpdatedAssetParams {
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name?: string;
imageUrl?: string;
animationUrl?: string;
description?: string;
animationUrlMimeType?: string;
collectionId: number;
}
export interface UpdateAssetMetadataParams {
name: string;
animationUrl: string;
animationUrlMimeType: string;
imageUrl: string;
attack: number;
collectable: boolean;
god: string;
element: string;
product: number;
rarity: number;
type: number;
}
export interface AssetMetadata {
name: string;
animationUrl: string;
animationUrlMimeType: string;
imageUrl: string;
attack: number;
collectable: boolean;
god: string;
element: string;
product: number;
rarity: number;
type: number;
}
/**
* @typedef {Object} QueryEqualMetadataNftAssetParams
* @property {number} assetId The ID of the asset for fetching the list of same NFTs (same with metadata)
*/
export interface QueryEqualMetadataNftAssetParams extends PagingDataParams {
assetId: number;
}
export interface GetAssetsByStarkKeyParams extends PagingDataParams {
starkKey: number;
}
export interface OrderTypeEqual extends OrderType {
amountSellUsd: number;
amountBuyUsd: number;
orderRequestId: null;
assetRefId: number;
}
export interface MetadataTypes {
name: string;
animationUrl: string;
animationUrlMimeType: string;
imageUrl: string;
attack: number;
collectable: boolean;
god: string;
element: string;
product: number;
rarity: number;
type: number;
}
/**
* @typedef {Object} NftAssetEqualMetadataResponse
* @property {number} id Id of the specific assets NFT
* @property {string} createdAt Created time for the NFT
* @property {string} updatedAt Updated time for the NFT
* @property {string} starkKey Owner stark key of the NFT
* @property {string} uri Metadata uri for the NFT
* @property {string} assetType Token type of the assets (ERC721/MINTABLE_ERC721/ERC20/MINTABLE_ERC20)
* @property {number} tokenId Unique token id of the NFT
* @property {string} tokenAddress Token address with the pointed deployed smart contract address
* @property {string} status Status of the NFT/Asset (MINTED / MINT_FAILED)
* @property {string} name Name of the asset NFT
* @property {string} description Description about the NFT
* @property {string} imageUrl Represented image for the NFTs/ assets
* @property {number} collectionId Id of the collection own this asset
* @property {Object} metadata Metadata of the NFTs
* @property {string} creatorStarkKey The stark key of creator
* @property {string} publicId The unique public id (uuid) of the assets/NFTs
* @property {string} assetMintId The hex string of the asset to map with the on-chain data
* @property {string} transactionId The unique transaction id number when the assets is minted
* @property {OrderType[]} order The order information (id, status, price...) for the Assets/NFTs
*/
export interface NftAssetEqualMetadataResponse {
id: number;
createdAt: string;
updatedAt: string;
starkKey: string;
uri: string;
assetType: string;
tokenId: string;
tokenAddress: string;
status: string;
name: string;
description: string;
imageUrl: string;
animationUrl: string;
animationUrlMimeType: string;
collectionId: number;
metadata: MetadataTypes;
creatorStarkKey: string;
publicId: string;
assetMintId: string;
transactionId: number;
order: OrderType[];
__entity: string;
}
export interface CollectionDetailsParams extends PagingDataParams {
sortingField?: string;
orderBy?: AssetOrderBy;
filterValue?: string[];
filterField?: string[];
collectionId: number;
listingAssetId?: string;
}
/**
* @typedef {Object} CollectionByIdDetailsParams
* @property {string?} sortingField The field for sorting to be based on (ex: created_at,...)
* @property {AssetOrderBy?} orderBy The order by (ASC/DESC) as the order of list returned assets
* @property {string} filterField The field name for filtering if the property of the assets is an object (ex: metadata)
* @property {any | string} filterValue The filter values with all of assets have the same filtering -
* Use case for this is to querying/filtering the attributes based on the NFT's metadata
* @property {number} collectionId The unique collection ID
* @property {string?} listingAssetId The asset ID for filtering of MYRIA/ETH
*/
export interface CollectionByIdDetailsParams extends PagingDataParams {
sortingField?: string;
orderBy?: AssetOrderBy;
filterValue?: any | string;
filterField?: string;
collectionId: number;
listingAssetId?: string;
}
export type AssetDictData = {
quantum?: string;
blob?: string;
tokenAddress?: string;
}
export interface AssetDictParams {
type: TokenType;
data: AssetDictData
}
/**
* @typedef {Object} RecrawlBatchNftMetadataParams
* @property {string} creatorStarkKey The stark key of the creator
* @property {string} startTokenId The start token id in the range for fetch and refresh the list of metadata tokens
* @property {string} endTokenId The end token id in the range for fetch and refresh the list of metadata tokens
* @property {string} tokenAddress The smart contract address of the token
*/
export interface RecrawlBatchNftMetadataParams {
creatorStarkKey: string,
startTokenId: string,
endTokenId: string,
tokenAddress: string
}
/**
* @typedef {Object} RecrawlBatchNftMetadataResponse
*/
export interface RecrawlBatchNftMetadataResponse {
}
/**
* @typedef {enum} AssetStatus
* @summary Status to indicate the asset state on system
* + MINT_FAILED: The asset has been minted failed on system due to some of potential reason
* + MINTING: The minting is on processing at system
* + MINTED: The asset has been minted successfully in Myria System
* + UNKNOWN: Unknown status of the assets
* + WITHDRAWING: The withdraw offchain is progressing on background at System
* + WITHDRAWAL_COMPLETED: The full process of withdraw is completed. Users has received on-chain balance in Metamask already.
*/
export enum AssetStatus {
MINT_FAILED = "MINT_FAILED",
MINTING = "MINTING",
MINTED = "MINTED",
UNKNOWN = "UNKNOWN",
WITHDRAWING = "WITHDRAWING",
WITHDRAWAL_COMPLETED = "WITHDRAWAL_COMPLETED",
}
/**
* @typedef {enum} AssetType
* @summary Type of the assets minted in Myria System (MINTABLE_ERC20 / MINTABLE_ERC721)
*/
export enum AssetType {
MINTABLE_ERC20 = "MINTABLE_ERC20",
MINTABLE_ERC721 = "MINTABLE_ERC721",
}
/**
* @typedef {enum} AnimationType
* @summary AnimationType for videos (such as mp4, webm)
*/
export enum AnimationType {
"application/vnd.apple.mpegurl" = "application/vnd.apple.mpegurl",
"video/mp4" = "video/mp4",
"video/webm" = "video/webm",
}
Source