From c2f2e5822feb3457a7cc2a1bbe11336c993844b2 Mon Sep 17 00:00:00 2001 From: VincentHoong Date: Mon, 3 Jun 2024 12:57:23 +0800 Subject: [PATCH] feat: expose sales endpoints --- .changeset/slimy-carrots-report.md | 6 + .../common/evmUtils/generator.config.json | 4 +- .../src/generated/client/abstractClient.ts | 34 +++++ .../GetNFTContractSalePricesOperation.ts | 58 ++++++++ .../operations/GetNFTSalePricesOperation.ts | 66 +++++++++ .../src/generated/operations/index.ts | 2 + .../src/generated/operations/operations.ts | 4 + .../src/generated/types/EvmNetWorthResult.ts | 10 ++ .../src/generated/types/EvmSoldPrice.ts | 88 ++++++++++++ .../types/EvmSoldPriceAverageSale.ts | 63 ++++++++ .../types/EvmSoldPriceHighestSale.ts | 136 ++++++++++++++++++ .../EvmSoldPriceHighestSalePaymentToken.ts | 85 +++++++++++ .../generated/types/EvmSoldPriceLastSale.ts | 136 ++++++++++++++++++ .../types/EvmSoldPriceLastSalePaymentToken.ts | 85 +++++++++++ .../generated/types/EvmSoldPriceLowestSale.ts | 136 ++++++++++++++++++ .../EvmSoldPriceLowestSalePaymentToken.ts | 85 +++++++++++ .../evmUtils/src/generated/types/index.ts | 8 ++ packages/evmApi/src/generated/ClientEvmApi.ts | 8 +- 18 files changed, 1012 insertions(+), 2 deletions(-) create mode 100644 .changeset/slimy-carrots-report.md create mode 100644 packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts create mode 100644 packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceAverageSale.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSale.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSalePaymentToken.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSale.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSalePaymentToken.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSale.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSalePaymentToken.ts diff --git a/.changeset/slimy-carrots-report.md b/.changeset/slimy-carrots-report.md new file mode 100644 index 0000000000..581562ae40 --- /dev/null +++ b/.changeset/slimy-carrots-report.md @@ -0,0 +1,6 @@ +--- +'@moralisweb3/common-evm-utils': minor +'@moralisweb3/evm-api': minor +--- + +Expose `getNFTContractSalePrices` & `getNFTSalePrices` diff --git a/packages/common/evmUtils/generator.config.json b/packages/common/evmUtils/generator.config.json index 9d2ffa9a01..36775530dc 100644 --- a/packages/common/evmUtils/generator.config.json +++ b/packages/common/evmUtils/generator.config.json @@ -118,7 +118,9 @@ "resolveAddressToDomain", "getTopCryptoCurrenciesByMarketCap", "getTopCryptoCurrenciesByTradingVolume", - "getWalletHistory" + "getWalletHistory", + "getNFTSalePrices", + "getNFTContractSalePrices" ] } } diff --git a/packages/common/evmUtils/src/generated/client/abstractClient.ts b/packages/common/evmUtils/src/generated/client/abstractClient.ts index dfbe2d303b..b7babf1674 100644 --- a/packages/common/evmUtils/src/generated/client/abstractClient.ts +++ b/packages/common/evmUtils/src/generated/client/abstractClient.ts @@ -1,5 +1,8 @@ import { GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationRequestJSON } from '../operations/GetNFTTradesOperation'; import { EvmTradeCollection, EvmTradeCollectionJSON } from '../types/EvmTradeCollection'; +import { GetNFTContractSalePricesOperation, GetNFTContractSalePricesOperationRequest, GetNFTContractSalePricesOperationRequestJSON } from '../operations/GetNFTContractSalePricesOperation'; +import { EvmSoldPrice, EvmSoldPriceJSON } from '../types/EvmSoldPrice'; +import { GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSalePricesOperationRequestJSON } from '../operations/GetNFTSalePricesOperation'; import { GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationRequestJSON } from '../operations/GetMultipleTokenPricesOperation'; import { EvmErc20Price, EvmErc20PriceJSON } from '../types/EvmErc20Price'; import { EvmGetMultipleTokenPricesDto, EvmGetMultipleTokenPricesDtoInput, EvmGetMultipleTokenPricesDtoJSON } from '../types/EvmGetMultipleTokenPricesDto'; @@ -196,6 +199,37 @@ export abstract class AbstractClient { EvmTradeCollection, EvmTradeCollectionJSON >(GetNFTTradesOperation), + /** + * @description Get the sold price for an NFT contract for the last x days (only trades paid in ETH). + * @param request Request with parameters. + * @param {Object} request.address The address of the NFT collection + * @param {Object} [request.chain] The chain to query (optional) + * @param {Number} [request.days] The number of days to look back to find the lowest price + * If not provided 7 days will be the default (optional) + * @returns {Object} Response for the request. + */ + getNFTContractSalePrices: this.createEndpoint< + GetNFTContractSalePricesOperationRequest, + GetNFTContractSalePricesOperationRequestJSON, + EvmSoldPrice, + EvmSoldPriceJSON + >(GetNFTContractSalePricesOperation), + /** + * @description Get the sold price for an NFT token for the last x days (only trades paid in ETH). + * @param request Request with parameters. + * @param {Object} request.address The address of the NFT collection + * @param {String} request.tokenId The token id of the NFT collection + * @param {Object} [request.chain] The chain to query (optional) + * @param {Number} [request.days] The number of days to look back to find the lowest price + * If not provided 7 days will be the default (optional) + * @returns {Object} Response for the request. + */ + getNFTSalePrices: this.createEndpoint< + GetNFTSalePricesOperationRequest, + GetNFTSalePricesOperationRequestJSON, + EvmSoldPrice, + EvmSoldPriceJSON + >(GetNFTSalePricesOperation), /** * @description Get the stats for a nft collection address. * @param request Request with parameters. diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts new file mode 100644 index 0000000000..6a9372ce89 --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts @@ -0,0 +1,58 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmSoldPrice, EvmSoldPriceJSON } from '../types/EvmSoldPrice'; + +// request parameters: +// - chain ($ref: #/components/schemas/nftTradesChainList) +// - days ($ref: #/paths/~1nft~1{address}~1price/get/parameters/1/schema) +// - address ($ref: #/paths/~1nft~1{address}~1price/get/parameters/2/schema) + +export interface GetNFTContractSalePricesOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description The number of days to look back to find the lowest price + * If not provided 7 days will be the default + */ + readonly days?: number; + /** + * @description The address of the NFT collection + */ + readonly address: EvmAddressInput | EvmAddress; +} + +export interface GetNFTContractSalePricesOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly days?: number; + readonly address: EvmAddressJSON; +} + +export type GetNFTContractSalePricesOperationResponse = EvmSoldPrice; +export type GetNFTContractSalePricesOperationResponseJSON = EvmSoldPriceJSON; + +export const GetNFTContractSalePricesOperation = { + operationId: "getNFTContractSalePrices", + groupName: "nft", + httpMethod: "get", + routePattern: "/nft/{address}/price", + parameterNames: ["chain","days","address"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmSoldPriceJSON): EvmSoldPrice { + return EvmSoldPrice.fromJSON(json); + }, + + serializeRequest(request: GetNFTContractSalePricesOperationRequest): GetNFTContractSalePricesOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const days = request.days; + const address = EvmAddress.create(request.address); + return { + chain: chain ? chain.toJSON() : undefined, + days: days, + address: address.toJSON(), + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts new file mode 100644 index 0000000000..708db170d8 --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts @@ -0,0 +1,66 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmSoldPrice, EvmSoldPriceJSON } from '../types/EvmSoldPrice'; + +// request parameters: +// - chain ($ref: #/components/schemas/nftTradesChainList) +// - days ($ref: #/paths/~1nft~1{address}~1{token_id}~1price/get/parameters/1/schema) +// - address ($ref: #/paths/~1nft~1{address}~1{token_id}~1price/get/parameters/2/schema) +// - token_id ($ref: #/paths/~1nft~1{address}~1{token_id}~1price/get/parameters/3/schema) + +export interface GetNFTSalePricesOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description The number of days to look back to find the lowest price + * If not provided 7 days will be the default + */ + readonly days?: number; + /** + * @description The address of the NFT collection + */ + readonly address: EvmAddressInput | EvmAddress; + /** + * @description The token id of the NFT collection + */ + readonly tokenId: string; +} + +export interface GetNFTSalePricesOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly days?: number; + readonly address: EvmAddressJSON; + readonly token_id: string; +} + +export type GetNFTSalePricesOperationResponse = EvmSoldPrice; +export type GetNFTSalePricesOperationResponseJSON = EvmSoldPriceJSON; + +export const GetNFTSalePricesOperation = { + operationId: "getNFTSalePrices", + groupName: "nft", + httpMethod: "get", + routePattern: "/nft/{address}/{token_id}/price", + parameterNames: ["chain","days","address","token_id"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmSoldPriceJSON): EvmSoldPrice { + return EvmSoldPrice.fromJSON(json); + }, + + serializeRequest(request: GetNFTSalePricesOperationRequest): GetNFTSalePricesOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const days = request.days; + const address = EvmAddress.create(request.address); + const tokenId = request.tokenId; + return { + chain: chain ? chain.toJSON() : undefined, + days: days, + address: address.toJSON(), + token_id: tokenId, + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/index.ts b/packages/common/evmUtils/src/generated/operations/index.ts index c305095a6d..122299391c 100644 --- a/packages/common/evmUtils/src/generated/operations/index.ts +++ b/packages/common/evmUtils/src/generated/operations/index.ts @@ -1,4 +1,6 @@ export * from './GetNFTTradesOperation'; +export * from './GetNFTContractSalePricesOperation'; +export * from './GetNFTSalePricesOperation'; export * from './GetMultipleTokenPricesOperation'; export * from './GetWalletHistoryOperation'; export * from './GetWalletTokenBalancesPriceOperation'; diff --git a/packages/common/evmUtils/src/generated/operations/operations.ts b/packages/common/evmUtils/src/generated/operations/operations.ts index 82880f024a..97c5811a66 100644 --- a/packages/common/evmUtils/src/generated/operations/operations.ts +++ b/packages/common/evmUtils/src/generated/operations/operations.ts @@ -1,4 +1,6 @@ import { GetNFTTradesOperation } from './GetNFTTradesOperation'; +import { GetNFTContractSalePricesOperation } from './GetNFTContractSalePricesOperation'; +import { GetNFTSalePricesOperation } from './GetNFTSalePricesOperation'; import { GetMultipleTokenPricesOperation } from './GetMultipleTokenPricesOperation'; import { GetWalletHistoryOperation } from './GetWalletHistoryOperation'; import { GetWalletTokenBalancesPriceOperation } from './GetWalletTokenBalancesPriceOperation'; @@ -23,6 +25,8 @@ import { GetBlockStatsOperation } from './GetBlockStatsOperation'; export const operations = [ GetNFTTradesOperation, + GetNFTContractSalePricesOperation, + GetNFTSalePricesOperation, GetMultipleTokenPricesOperation, GetWalletHistoryOperation, GetWalletTokenBalancesPriceOperation, diff --git a/packages/common/evmUtils/src/generated/types/EvmNetWorthResult.ts b/packages/common/evmUtils/src/generated/types/EvmNetWorthResult.ts index f784a53d8c..24692b3d2a 100644 --- a/packages/common/evmUtils/src/generated/types/EvmNetWorthResult.ts +++ b/packages/common/evmUtils/src/generated/types/EvmNetWorthResult.ts @@ -5,15 +5,18 @@ import { EvmChainNetWorth, EvmChainNetWorthInput, EvmChainNetWorthJSON } from '. // properties: // - total_networth_usd ($ref: #/components/schemas/netWorthResult/properties/total_networth_usd) // - chains ($ref: #/components/schemas/chainNetWorth) +// - unsupported_chain_ids ($ref: #/components/schemas/netWorthResult/properties/unsupported_chain_ids) export interface EvmNetWorthResultJSON { readonly total_networth_usd: string; readonly chains: EvmChainNetWorthJSON[]; + readonly unsupported_chain_ids?: string[]; } export interface EvmNetWorthResultInput { readonly totalNetworthUsd: string; readonly chains: EvmChainNetWorthInput[] | EvmChainNetWorth[]; + readonly unsupportedChainIds?: string[]; } export class EvmNetWorthResult { @@ -28,6 +31,7 @@ export class EvmNetWorthResult { const input: EvmNetWorthResultInput = { totalNetworthUsd: json.total_networth_usd, chains: json.chains.map((item) => EvmChainNetWorth.fromJSON(item)), + unsupportedChainIds: json.unsupported_chain_ids, }; return EvmNetWorthResult.create(input); } @@ -37,16 +41,22 @@ export class EvmNetWorthResult { */ public readonly totalNetworthUsd: string; public readonly chains: EvmChainNetWorth[]; + /** + * @description The chain ids that are not supported + */ + public readonly unsupportedChainIds?: string[]; private constructor(input: EvmNetWorthResultInput) { this.totalNetworthUsd = input.totalNetworthUsd; this.chains = input.chains.map((item) => EvmChainNetWorth.create(item)); + this.unsupportedChainIds = input.unsupportedChainIds; } public toJSON(): EvmNetWorthResultJSON { return { total_networth_usd: this.totalNetworthUsd, chains: this.chains.map((item) => item.toJSON()), + unsupported_chain_ids: this.unsupportedChainIds, } } } diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts new file mode 100644 index 0000000000..227fd5ff27 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts @@ -0,0 +1,88 @@ +import { EvmSoldPriceLastSale, EvmSoldPriceLastSaleInput, EvmSoldPriceLastSaleJSON } from '../types/EvmSoldPriceLastSale'; +import { EvmSoldPriceLowestSale, EvmSoldPriceLowestSaleInput, EvmSoldPriceLowestSaleJSON } from '../types/EvmSoldPriceLowestSale'; +import { EvmSoldPriceHighestSale, EvmSoldPriceHighestSaleInput, EvmSoldPriceHighestSaleJSON } from '../types/EvmSoldPriceHighestSale'; +import { EvmSoldPriceAverageSale, EvmSoldPriceAverageSaleInput, EvmSoldPriceAverageSaleJSON } from '../types/EvmSoldPriceAverageSale'; + +// $ref: #/components/schemas/soldPrice +// type: soldPrice +// properties: +// - last_sale ($ref: #/components/schemas/soldPrice/properties/last_sale) +// - lowest_sale ($ref: #/components/schemas/soldPrice/properties/lowest_sale) +// - highest_sale ($ref: #/components/schemas/soldPrice/properties/highest_sale) +// - average_sale ($ref: #/components/schemas/soldPrice/properties/average_sale) +// - total_trades ($ref: #/components/schemas/soldPrice/properties/total_trades) + +export interface EvmSoldPriceJSON { + readonly last_sale: EvmSoldPriceLastSaleJSON; + readonly lowest_sale: EvmSoldPriceLowestSaleJSON; + readonly highest_sale: EvmSoldPriceHighestSaleJSON; + readonly average_sale: EvmSoldPriceAverageSaleJSON; + readonly total_trades?: number; +} + +export interface EvmSoldPriceInput { + readonly lastSale: EvmSoldPriceLastSaleInput | EvmSoldPriceLastSale; + readonly lowestSale: EvmSoldPriceLowestSaleInput | EvmSoldPriceLowestSale; + readonly highestSale: EvmSoldPriceHighestSaleInput | EvmSoldPriceHighestSale; + readonly averageSale: EvmSoldPriceAverageSaleInput | EvmSoldPriceAverageSale; + readonly totalTrades?: number; +} + +export class EvmSoldPrice { + public static create(input: EvmSoldPriceInput | EvmSoldPrice): EvmSoldPrice { + if (input instanceof EvmSoldPrice) { + return input; + } + return new EvmSoldPrice(input); + } + + public static fromJSON(json: EvmSoldPriceJSON): EvmSoldPrice { + const input: EvmSoldPriceInput = { + lastSale: EvmSoldPriceLastSale.fromJSON(json.last_sale), + lowestSale: EvmSoldPriceLowestSale.fromJSON(json.lowest_sale), + highestSale: EvmSoldPriceHighestSale.fromJSON(json.highest_sale), + averageSale: EvmSoldPriceAverageSale.fromJSON(json.average_sale), + totalTrades: json.total_trades, + }; + return EvmSoldPrice.create(input); + } + + /** + * @description The sales price of the NFT collection + */ + public readonly lastSale: EvmSoldPriceLastSale; + /** + * @description The lowest sale of the NFT collection + */ + public readonly lowestSale: EvmSoldPriceLowestSale; + /** + * @description The highest sale of the NFT collection + */ + public readonly highestSale: EvmSoldPriceHighestSale; + /** + * @description The average sale of the NFT collection + */ + public readonly averageSale: EvmSoldPriceAverageSale; + /** + * @description The total trades in the timeframe + */ + public readonly totalTrades?: number; + + private constructor(input: EvmSoldPriceInput) { + this.lastSale = EvmSoldPriceLastSale.create(input.lastSale); + this.lowestSale = EvmSoldPriceLowestSale.create(input.lowestSale); + this.highestSale = EvmSoldPriceHighestSale.create(input.highestSale); + this.averageSale = EvmSoldPriceAverageSale.create(input.averageSale); + this.totalTrades = input.totalTrades; + } + + public toJSON(): EvmSoldPriceJSON { + return { + last_sale: this.lastSale.toJSON(), + lowest_sale: this.lowestSale.toJSON(), + highest_sale: this.highestSale.toJSON(), + average_sale: this.averageSale.toJSON(), + total_trades: this.totalTrades, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceAverageSale.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceAverageSale.ts new file mode 100644 index 0000000000..f9920a1317 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceAverageSale.ts @@ -0,0 +1,63 @@ +// $ref: #/components/schemas/soldPrice/properties/average_sale +// type: soldPrice_average_sale +// properties: +// - price ($ref: #/components/schemas/soldPrice/properties/average_sale/properties/price) +// - price_formatted ($ref: #/components/schemas/soldPrice/properties/average_sale/properties/price_formatted) +// - current_usd_value ($ref: #/components/schemas/soldPrice/properties/average_sale/properties/current_usd_value) + +export interface EvmSoldPriceAverageSaleJSON { + readonly price: string; + readonly price_formatted: string; + readonly current_usd_value?: string; +} + +export interface EvmSoldPriceAverageSaleInput { + readonly price: string; + readonly priceFormatted: string; + readonly currentUsdValue?: string; +} + +export class EvmSoldPriceAverageSale { + public static create(input: EvmSoldPriceAverageSaleInput | EvmSoldPriceAverageSale): EvmSoldPriceAverageSale { + if (input instanceof EvmSoldPriceAverageSale) { + return input; + } + return new EvmSoldPriceAverageSale(input); + } + + public static fromJSON(json: EvmSoldPriceAverageSaleJSON): EvmSoldPriceAverageSale { + const input: EvmSoldPriceAverageSaleInput = { + price: json.price, + priceFormatted: json.price_formatted, + currentUsdValue: json.current_usd_value, + }; + return EvmSoldPriceAverageSale.create(input); + } + + /** + * @description The price of the average sale + */ + public readonly price: string; + /** + * @description The formatted price of the average sale + */ + public readonly priceFormatted: string; + /** + * @description The USD price of the last sale at the current value + */ + public readonly currentUsdValue?: string; + + private constructor(input: EvmSoldPriceAverageSaleInput) { + this.price = input.price; + this.priceFormatted = input.priceFormatted; + this.currentUsdValue = input.currentUsdValue; + } + + public toJSON(): EvmSoldPriceAverageSaleJSON { + return { + price: this.price, + price_formatted: this.priceFormatted, + current_usd_value: this.currentUsdValue, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSale.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSale.ts new file mode 100644 index 0000000000..feb986d9a3 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSale.ts @@ -0,0 +1,136 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmSoldPriceHighestSalePaymentToken, EvmSoldPriceHighestSalePaymentTokenInput, EvmSoldPriceHighestSalePaymentTokenJSON } from '../types/EvmSoldPriceHighestSalePaymentToken'; + +// $ref: #/components/schemas/soldPrice/properties/highest_sale +// type: soldPrice_highest_sale +// properties: +// - transaction_hash ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/transaction_hash) +// - block_timestamp ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/block_timestamp) +// - buyer_address ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/buyer_address) +// - seller_address ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/seller_address) +// - price ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/price) +// - price_formatted ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/price_formatted) +// - usd_price_at_sale ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/usd_price_at_sale) +// - current_usd_value ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/current_usd_value) +// - token_id ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/token_id) +// - payment_token ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token) + +export interface EvmSoldPriceHighestSaleJSON { + readonly transaction_hash: string; + readonly block_timestamp: string; + readonly buyer_address?: EvmAddressJSON; + readonly seller_address?: EvmAddressJSON; + readonly price: string; + readonly price_formatted: string; + readonly usd_price_at_sale?: string; + readonly current_usd_value?: string; + readonly token_id?: string; + readonly payment_token: EvmSoldPriceHighestSalePaymentTokenJSON; +} + +export interface EvmSoldPriceHighestSaleInput { + readonly transactionHash: string; + readonly blockTimestamp: string; + readonly buyerAddress?: EvmAddressInput | EvmAddress; + readonly sellerAddress?: EvmAddressInput | EvmAddress; + readonly price: string; + readonly priceFormatted: string; + readonly usdPriceAtSale?: string; + readonly currentUsdValue?: string; + readonly tokenId?: string; + readonly paymentToken: EvmSoldPriceHighestSalePaymentTokenInput | EvmSoldPriceHighestSalePaymentToken; +} + +export class EvmSoldPriceHighestSale { + public static create(input: EvmSoldPriceHighestSaleInput | EvmSoldPriceHighestSale): EvmSoldPriceHighestSale { + if (input instanceof EvmSoldPriceHighestSale) { + return input; + } + return new EvmSoldPriceHighestSale(input); + } + + public static fromJSON(json: EvmSoldPriceHighestSaleJSON): EvmSoldPriceHighestSale { + const input: EvmSoldPriceHighestSaleInput = { + transactionHash: json.transaction_hash, + blockTimestamp: json.block_timestamp, + buyerAddress: json.buyer_address ? EvmAddress.fromJSON(json.buyer_address) : undefined, + sellerAddress: json.seller_address ? EvmAddress.fromJSON(json.seller_address) : undefined, + price: json.price, + priceFormatted: json.price_formatted, + usdPriceAtSale: json.usd_price_at_sale, + currentUsdValue: json.current_usd_value, + tokenId: json.token_id, + paymentToken: EvmSoldPriceHighestSalePaymentToken.fromJSON(json.payment_token), + }; + return EvmSoldPriceHighestSale.create(input); + } + + /** + * @description The transaction hash of the last sale + */ + public readonly transactionHash: string; + /** + * @description The block timestamp of the last sale + */ + public readonly blockTimestamp: string; + /** + * @description The buyer address of the last sale + */ + public readonly buyerAddress?: EvmAddress; + /** + * @description The seller address of the last sale + */ + public readonly sellerAddress?: EvmAddress; + /** + * @description The price of the last sale + */ + public readonly price: string; + /** + * @description The formatted price of the last sale + */ + public readonly priceFormatted: string; + /** + * @description The USD price of the last sale at sale time + */ + public readonly usdPriceAtSale?: string; + /** + * @description The USD price of the last sale at the current value + */ + public readonly currentUsdValue?: string; + /** + * @description The token ID that is sold + */ + public readonly tokenId?: string; + /** + * @description The ERC20 token that is being traded with + */ + public readonly paymentToken: EvmSoldPriceHighestSalePaymentToken; + + private constructor(input: EvmSoldPriceHighestSaleInput) { + this.transactionHash = input.transactionHash; + this.blockTimestamp = input.blockTimestamp; + this.buyerAddress = input.buyerAddress ? EvmAddress.create(input.buyerAddress) : undefined; + this.sellerAddress = input.sellerAddress ? EvmAddress.create(input.sellerAddress) : undefined; + this.price = input.price; + this.priceFormatted = input.priceFormatted; + this.usdPriceAtSale = input.usdPriceAtSale; + this.currentUsdValue = input.currentUsdValue; + this.tokenId = input.tokenId; + this.paymentToken = EvmSoldPriceHighestSalePaymentToken.create(input.paymentToken); + } + + public toJSON(): EvmSoldPriceHighestSaleJSON { + return { + transaction_hash: this.transactionHash, + block_timestamp: this.blockTimestamp, + buyer_address: this.buyerAddress ? this.buyerAddress.toJSON() : undefined, + seller_address: this.sellerAddress ? this.sellerAddress.toJSON() : undefined, + price: this.price, + price_formatted: this.priceFormatted, + usd_price_at_sale: this.usdPriceAtSale, + current_usd_value: this.currentUsdValue, + token_id: this.tokenId, + payment_token: this.paymentToken.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSalePaymentToken.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSalePaymentToken.ts new file mode 100644 index 0000000000..49c64059c4 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceHighestSalePaymentToken.ts @@ -0,0 +1,85 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token +// type: soldPrice_highest_sale_payment_token +// properties: +// - token_name ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token/properties/token_name) +// - token_symbol ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token/properties/token_symbol) +// - token_logo ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token/properties/token_logo) +// - token_decimals ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token/properties/token_decimals) +// - token_address ($ref: #/components/schemas/soldPrice/properties/highest_sale/properties/payment_token/properties/token_address) + +export interface EvmSoldPriceHighestSalePaymentTokenJSON { + readonly token_name: string; + readonly token_symbol: string; + readonly token_logo: string; + readonly token_decimals: string; + readonly token_address: EvmAddressJSON; +} + +export interface EvmSoldPriceHighestSalePaymentTokenInput { + readonly tokenName: string; + readonly tokenSymbol: string; + readonly tokenLogo: string; + readonly tokenDecimals: number; + readonly tokenAddress: EvmAddressInput | EvmAddress; +} + +export class EvmSoldPriceHighestSalePaymentToken { + public static create(input: EvmSoldPriceHighestSalePaymentTokenInput | EvmSoldPriceHighestSalePaymentToken): EvmSoldPriceHighestSalePaymentToken { + if (input instanceof EvmSoldPriceHighestSalePaymentToken) { + return input; + } + return new EvmSoldPriceHighestSalePaymentToken(input); + } + + public static fromJSON(json: EvmSoldPriceHighestSalePaymentTokenJSON): EvmSoldPriceHighestSalePaymentToken { + const input: EvmSoldPriceHighestSalePaymentTokenInput = { + tokenName: json.token_name, + tokenSymbol: json.token_symbol, + tokenLogo: json.token_logo, + tokenDecimals: Number(json.token_decimals), + tokenAddress: EvmAddress.fromJSON(json.token_address), + }; + return EvmSoldPriceHighestSalePaymentToken.create(input); + } + + /** + * @description The token name + */ + public readonly tokenName: string; + /** + * @description The token symbol + */ + public readonly tokenSymbol: string; + /** + * @description The token logo + */ + public readonly tokenLogo: string; + /** + * @description The token decimals + */ + public readonly tokenDecimals: number; + /** + * @description The token address + */ + public readonly tokenAddress: EvmAddress; + + private constructor(input: EvmSoldPriceHighestSalePaymentTokenInput) { + this.tokenName = input.tokenName; + this.tokenSymbol = input.tokenSymbol; + this.tokenLogo = input.tokenLogo; + this.tokenDecimals = input.tokenDecimals; + this.tokenAddress = EvmAddress.create(input.tokenAddress); + } + + public toJSON(): EvmSoldPriceHighestSalePaymentTokenJSON { + return { + token_name: this.tokenName, + token_symbol: this.tokenSymbol, + token_logo: this.tokenLogo, + token_decimals: String(this.tokenDecimals), + token_address: this.tokenAddress.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSale.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSale.ts new file mode 100644 index 0000000000..783c5a08e6 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSale.ts @@ -0,0 +1,136 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmSoldPriceLastSalePaymentToken, EvmSoldPriceLastSalePaymentTokenInput, EvmSoldPriceLastSalePaymentTokenJSON } from '../types/EvmSoldPriceLastSalePaymentToken'; + +// $ref: #/components/schemas/soldPrice/properties/last_sale +// type: soldPrice_last_sale +// properties: +// - transaction_hash ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/transaction_hash) +// - block_timestamp ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/block_timestamp) +// - buyer_address ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/buyer_address) +// - seller_address ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/seller_address) +// - price ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/price) +// - price_formatted ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/price_formatted) +// - usd_price_at_sale ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/usd_price_at_sale) +// - current_usd_value ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/current_usd_value) +// - token_id ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/token_id) +// - payment_token ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token) + +export interface EvmSoldPriceLastSaleJSON { + readonly transaction_hash: string; + readonly block_timestamp: string; + readonly buyer_address: EvmAddressJSON; + readonly seller_address: EvmAddressJSON; + readonly price: string; + readonly price_formatted: string; + readonly usd_price_at_sale?: string; + readonly current_usd_value?: string; + readonly token_id?: string; + readonly payment_token: EvmSoldPriceLastSalePaymentTokenJSON; +} + +export interface EvmSoldPriceLastSaleInput { + readonly transactionHash: string; + readonly blockTimestamp: string; + readonly buyerAddress: EvmAddressInput | EvmAddress; + readonly sellerAddress: EvmAddressInput | EvmAddress; + readonly price: string; + readonly priceFormatted: string; + readonly usdPriceAtSale?: string; + readonly currentUsdValue?: string; + readonly tokenId?: string; + readonly paymentToken: EvmSoldPriceLastSalePaymentTokenInput | EvmSoldPriceLastSalePaymentToken; +} + +export class EvmSoldPriceLastSale { + public static create(input: EvmSoldPriceLastSaleInput | EvmSoldPriceLastSale): EvmSoldPriceLastSale { + if (input instanceof EvmSoldPriceLastSale) { + return input; + } + return new EvmSoldPriceLastSale(input); + } + + public static fromJSON(json: EvmSoldPriceLastSaleJSON): EvmSoldPriceLastSale { + const input: EvmSoldPriceLastSaleInput = { + transactionHash: json.transaction_hash, + blockTimestamp: json.block_timestamp, + buyerAddress: EvmAddress.fromJSON(json.buyer_address), + sellerAddress: EvmAddress.fromJSON(json.seller_address), + price: json.price, + priceFormatted: json.price_formatted, + usdPriceAtSale: json.usd_price_at_sale, + currentUsdValue: json.current_usd_value, + tokenId: json.token_id, + paymentToken: EvmSoldPriceLastSalePaymentToken.fromJSON(json.payment_token), + }; + return EvmSoldPriceLastSale.create(input); + } + + /** + * @description The transaction hash of the last sale + */ + public readonly transactionHash: string; + /** + * @description The block timestamp of the last sale + */ + public readonly blockTimestamp: string; + /** + * @description The buyer address of the last sale + */ + public readonly buyerAddress: EvmAddress; + /** + * @description The seller address of the last sale + */ + public readonly sellerAddress: EvmAddress; + /** + * @description The price of the last sale + */ + public readonly price: string; + /** + * @description The formatted price of the last sale + */ + public readonly priceFormatted: string; + /** + * @description The USD price of the last sale at sale time + */ + public readonly usdPriceAtSale?: string; + /** + * @description The USD price of the last sale at the current value + */ + public readonly currentUsdValue?: string; + /** + * @description The token ID that is sold + */ + public readonly tokenId?: string; + /** + * @description The ERC20 token that is being traded with + */ + public readonly paymentToken: EvmSoldPriceLastSalePaymentToken; + + private constructor(input: EvmSoldPriceLastSaleInput) { + this.transactionHash = input.transactionHash; + this.blockTimestamp = input.blockTimestamp; + this.buyerAddress = EvmAddress.create(input.buyerAddress); + this.sellerAddress = EvmAddress.create(input.sellerAddress); + this.price = input.price; + this.priceFormatted = input.priceFormatted; + this.usdPriceAtSale = input.usdPriceAtSale; + this.currentUsdValue = input.currentUsdValue; + this.tokenId = input.tokenId; + this.paymentToken = EvmSoldPriceLastSalePaymentToken.create(input.paymentToken); + } + + public toJSON(): EvmSoldPriceLastSaleJSON { + return { + transaction_hash: this.transactionHash, + block_timestamp: this.blockTimestamp, + buyer_address: this.buyerAddress.toJSON(), + seller_address: this.sellerAddress.toJSON(), + price: this.price, + price_formatted: this.priceFormatted, + usd_price_at_sale: this.usdPriceAtSale, + current_usd_value: this.currentUsdValue, + token_id: this.tokenId, + payment_token: this.paymentToken.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSalePaymentToken.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSalePaymentToken.ts new file mode 100644 index 0000000000..630fd9d993 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLastSalePaymentToken.ts @@ -0,0 +1,85 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token +// type: soldPrice_last_sale_payment_token +// properties: +// - token_name ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token/properties/token_name) +// - token_symbol ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token/properties/token_symbol) +// - token_logo ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token/properties/token_logo) +// - token_decimals ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token/properties/token_decimals) +// - token_address ($ref: #/components/schemas/soldPrice/properties/last_sale/properties/payment_token/properties/token_address) + +export interface EvmSoldPriceLastSalePaymentTokenJSON { + readonly token_name: string; + readonly token_symbol: string; + readonly token_logo: string; + readonly token_decimals: string; + readonly token_address: EvmAddressJSON; +} + +export interface EvmSoldPriceLastSalePaymentTokenInput { + readonly tokenName: string; + readonly tokenSymbol: string; + readonly tokenLogo: string; + readonly tokenDecimals: number; + readonly tokenAddress: EvmAddressInput | EvmAddress; +} + +export class EvmSoldPriceLastSalePaymentToken { + public static create(input: EvmSoldPriceLastSalePaymentTokenInput | EvmSoldPriceLastSalePaymentToken): EvmSoldPriceLastSalePaymentToken { + if (input instanceof EvmSoldPriceLastSalePaymentToken) { + return input; + } + return new EvmSoldPriceLastSalePaymentToken(input); + } + + public static fromJSON(json: EvmSoldPriceLastSalePaymentTokenJSON): EvmSoldPriceLastSalePaymentToken { + const input: EvmSoldPriceLastSalePaymentTokenInput = { + tokenName: json.token_name, + tokenSymbol: json.token_symbol, + tokenLogo: json.token_logo, + tokenDecimals: Number(json.token_decimals), + tokenAddress: EvmAddress.fromJSON(json.token_address), + }; + return EvmSoldPriceLastSalePaymentToken.create(input); + } + + /** + * @description The token name + */ + public readonly tokenName: string; + /** + * @description The token symbol + */ + public readonly tokenSymbol: string; + /** + * @description The token logo + */ + public readonly tokenLogo: string; + /** + * @description The token decimals + */ + public readonly tokenDecimals: number; + /** + * @description The token address + */ + public readonly tokenAddress: EvmAddress; + + private constructor(input: EvmSoldPriceLastSalePaymentTokenInput) { + this.tokenName = input.tokenName; + this.tokenSymbol = input.tokenSymbol; + this.tokenLogo = input.tokenLogo; + this.tokenDecimals = input.tokenDecimals; + this.tokenAddress = EvmAddress.create(input.tokenAddress); + } + + public toJSON(): EvmSoldPriceLastSalePaymentTokenJSON { + return { + token_name: this.tokenName, + token_symbol: this.tokenSymbol, + token_logo: this.tokenLogo, + token_decimals: String(this.tokenDecimals), + token_address: this.tokenAddress.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSale.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSale.ts new file mode 100644 index 0000000000..92ce4d8584 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSale.ts @@ -0,0 +1,136 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmSoldPriceLowestSalePaymentToken, EvmSoldPriceLowestSalePaymentTokenInput, EvmSoldPriceLowestSalePaymentTokenJSON } from '../types/EvmSoldPriceLowestSalePaymentToken'; + +// $ref: #/components/schemas/soldPrice/properties/lowest_sale +// type: soldPrice_lowest_sale +// properties: +// - transaction_hash ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/transaction_hash) +// - block_timestamp ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/block_timestamp) +// - buyer_address ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/buyer_address) +// - seller_address ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/seller_address) +// - price ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/price) +// - price_formatted ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/price_formatted) +// - usd_price_at_sale ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/usd_price_at_sale) +// - current_usd_value ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/current_usd_value) +// - token_id ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/token_id) +// - payment_token ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token) + +export interface EvmSoldPriceLowestSaleJSON { + readonly transaction_hash: string; + readonly block_timestamp: string; + readonly buyer_address?: EvmAddressJSON; + readonly seller_address?: EvmAddressJSON; + readonly price: string; + readonly price_formatted: string; + readonly usd_price_at_sale?: string; + readonly current_usd_value?: string; + readonly token_id?: string; + readonly payment_token: EvmSoldPriceLowestSalePaymentTokenJSON; +} + +export interface EvmSoldPriceLowestSaleInput { + readonly transactionHash: string; + readonly blockTimestamp: string; + readonly buyerAddress?: EvmAddressInput | EvmAddress; + readonly sellerAddress?: EvmAddressInput | EvmAddress; + readonly price: string; + readonly priceFormatted: string; + readonly usdPriceAtSale?: string; + readonly currentUsdValue?: string; + readonly tokenId?: string; + readonly paymentToken: EvmSoldPriceLowestSalePaymentTokenInput | EvmSoldPriceLowestSalePaymentToken; +} + +export class EvmSoldPriceLowestSale { + public static create(input: EvmSoldPriceLowestSaleInput | EvmSoldPriceLowestSale): EvmSoldPriceLowestSale { + if (input instanceof EvmSoldPriceLowestSale) { + return input; + } + return new EvmSoldPriceLowestSale(input); + } + + public static fromJSON(json: EvmSoldPriceLowestSaleJSON): EvmSoldPriceLowestSale { + const input: EvmSoldPriceLowestSaleInput = { + transactionHash: json.transaction_hash, + blockTimestamp: json.block_timestamp, + buyerAddress: json.buyer_address ? EvmAddress.fromJSON(json.buyer_address) : undefined, + sellerAddress: json.seller_address ? EvmAddress.fromJSON(json.seller_address) : undefined, + price: json.price, + priceFormatted: json.price_formatted, + usdPriceAtSale: json.usd_price_at_sale, + currentUsdValue: json.current_usd_value, + tokenId: json.token_id, + paymentToken: EvmSoldPriceLowestSalePaymentToken.fromJSON(json.payment_token), + }; + return EvmSoldPriceLowestSale.create(input); + } + + /** + * @description The transaction hash of the last sale + */ + public readonly transactionHash: string; + /** + * @description The block timestamp of the last sale + */ + public readonly blockTimestamp: string; + /** + * @description The buyer address of the last sale + */ + public readonly buyerAddress?: EvmAddress; + /** + * @description The seller address of the last sale + */ + public readonly sellerAddress?: EvmAddress; + /** + * @description The price of the last sale + */ + public readonly price: string; + /** + * @description The formatted price of the last sale + */ + public readonly priceFormatted: string; + /** + * @description The USD price of the last sale at sale time + */ + public readonly usdPriceAtSale?: string; + /** + * @description The USD price of the last sale at the current value + */ + public readonly currentUsdValue?: string; + /** + * @description The token ID that is sold + */ + public readonly tokenId?: string; + /** + * @description The ERC20 token that is being traded with + */ + public readonly paymentToken: EvmSoldPriceLowestSalePaymentToken; + + private constructor(input: EvmSoldPriceLowestSaleInput) { + this.transactionHash = input.transactionHash; + this.blockTimestamp = input.blockTimestamp; + this.buyerAddress = input.buyerAddress ? EvmAddress.create(input.buyerAddress) : undefined; + this.sellerAddress = input.sellerAddress ? EvmAddress.create(input.sellerAddress) : undefined; + this.price = input.price; + this.priceFormatted = input.priceFormatted; + this.usdPriceAtSale = input.usdPriceAtSale; + this.currentUsdValue = input.currentUsdValue; + this.tokenId = input.tokenId; + this.paymentToken = EvmSoldPriceLowestSalePaymentToken.create(input.paymentToken); + } + + public toJSON(): EvmSoldPriceLowestSaleJSON { + return { + transaction_hash: this.transactionHash, + block_timestamp: this.blockTimestamp, + buyer_address: this.buyerAddress ? this.buyerAddress.toJSON() : undefined, + seller_address: this.sellerAddress ? this.sellerAddress.toJSON() : undefined, + price: this.price, + price_formatted: this.priceFormatted, + usd_price_at_sale: this.usdPriceAtSale, + current_usd_value: this.currentUsdValue, + token_id: this.tokenId, + payment_token: this.paymentToken.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSalePaymentToken.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSalePaymentToken.ts new file mode 100644 index 0000000000..a4f88df2bf --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPriceLowestSalePaymentToken.ts @@ -0,0 +1,85 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token +// type: soldPrice_lowest_sale_payment_token +// properties: +// - token_name ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token/properties/token_name) +// - token_symbol ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token/properties/token_symbol) +// - token_logo ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token/properties/token_logo) +// - token_decimals ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token/properties/token_decimals) +// - token_address ($ref: #/components/schemas/soldPrice/properties/lowest_sale/properties/payment_token/properties/token_address) + +export interface EvmSoldPriceLowestSalePaymentTokenJSON { + readonly token_name: string; + readonly token_symbol: string; + readonly token_logo: string; + readonly token_decimals: string; + readonly token_address: EvmAddressJSON; +} + +export interface EvmSoldPriceLowestSalePaymentTokenInput { + readonly tokenName: string; + readonly tokenSymbol: string; + readonly tokenLogo: string; + readonly tokenDecimals: number; + readonly tokenAddress: EvmAddressInput | EvmAddress; +} + +export class EvmSoldPriceLowestSalePaymentToken { + public static create(input: EvmSoldPriceLowestSalePaymentTokenInput | EvmSoldPriceLowestSalePaymentToken): EvmSoldPriceLowestSalePaymentToken { + if (input instanceof EvmSoldPriceLowestSalePaymentToken) { + return input; + } + return new EvmSoldPriceLowestSalePaymentToken(input); + } + + public static fromJSON(json: EvmSoldPriceLowestSalePaymentTokenJSON): EvmSoldPriceLowestSalePaymentToken { + const input: EvmSoldPriceLowestSalePaymentTokenInput = { + tokenName: json.token_name, + tokenSymbol: json.token_symbol, + tokenLogo: json.token_logo, + tokenDecimals: Number(json.token_decimals), + tokenAddress: EvmAddress.fromJSON(json.token_address), + }; + return EvmSoldPriceLowestSalePaymentToken.create(input); + } + + /** + * @description The token name + */ + public readonly tokenName: string; + /** + * @description The token symbol + */ + public readonly tokenSymbol: string; + /** + * @description The token logo + */ + public readonly tokenLogo: string; + /** + * @description The token decimals + */ + public readonly tokenDecimals: number; + /** + * @description The token address + */ + public readonly tokenAddress: EvmAddress; + + private constructor(input: EvmSoldPriceLowestSalePaymentTokenInput) { + this.tokenName = input.tokenName; + this.tokenSymbol = input.tokenSymbol; + this.tokenLogo = input.tokenLogo; + this.tokenDecimals = input.tokenDecimals; + this.tokenAddress = EvmAddress.create(input.tokenAddress); + } + + public toJSON(): EvmSoldPriceLowestSalePaymentTokenJSON { + return { + token_name: this.tokenName, + token_symbol: this.tokenSymbol, + token_logo: this.tokenLogo, + token_decimals: String(this.tokenDecimals), + token_address: this.tokenAddress.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/index.ts b/packages/common/evmUtils/src/generated/types/index.ts index f3f0822351..a59ace765f 100644 --- a/packages/common/evmUtils/src/generated/types/index.ts +++ b/packages/common/evmUtils/src/generated/types/index.ts @@ -10,6 +10,7 @@ export * from './EvmContractsReviewItemReportTypeEnum'; export * from './EvmContractsReviewItemContractTypeEnum'; export * from './EvmNormalizedMetadataAttributeValue'; export * from './EvmTradeCollection'; +export * from './EvmSoldPrice'; export * from './EvmErc20Price'; export * from './EvmGetMultipleTokenPricesDto'; export * from './EvmWalletHistory'; @@ -33,6 +34,10 @@ export * from './EvmNftTokenStat'; export * from './EvmErc20TokenStat'; export * from './EvmBlockTokenStat'; export * from './EvmTrade'; +export * from './EvmSoldPriceLastSale'; +export * from './EvmSoldPriceLowestSale'; +export * from './EvmSoldPriceHighestSale'; +export * from './EvmSoldPriceAverageSale'; export * from './EvmNativeErc20Price'; export * from './EvmTokenPriceItem'; export * from './EvmWalletHistoryTransaction'; @@ -51,6 +56,9 @@ export * from './EvmNftTokenStatTransfers'; export * from './EvmErc20TokenStatTransfers'; export * from './EvmBlockTokenStatTransactions'; export * from './EvmBlockTokenStatNftTransfers'; +export * from './EvmSoldPriceLastSalePaymentToken'; +export * from './EvmSoldPriceLowestSalePaymentToken'; +export * from './EvmSoldPriceHighestSalePaymentToken'; export * from './EvmWalletHistoryNftTransfer'; export * from './EvmWalletHistoryErc20Transfer'; export * from './EvmNativeTransfer'; diff --git a/packages/evmApi/src/generated/ClientEvmApi.ts b/packages/evmApi/src/generated/ClientEvmApi.ts index 05aef4b63d..b69ccfd9b6 100644 --- a/packages/evmApi/src/generated/ClientEvmApi.ts +++ b/packages/evmApi/src/generated/ClientEvmApi.ts @@ -1,6 +1,6 @@ // CAUTION: This file is automatically generated. Do not edit it manually! -import { getBlockOperation, GetBlockRequest, GetBlockResponseAdapter, getDateToBlockOperation, GetDateToBlockRequest, GetDateToBlockResponseAdapter, GetBlockStatsOperationResponseJSON, GetBlockStatsOperation, GetBlockStatsOperationRequest, GetBlockStatsOperationResponse, getContractEventsOperation, GetContractEventsRequest, GetContractEventsResponseAdapter, getContractLogsOperation, GetContractLogsRequest, GetContractLogsResponseAdapter, getContractNFTsOperation, GetContractNFTsRequest, GetContractNFTsResponseAdapter, getMultipleNFTsOperation, GetMultipleNFTsRequest, GetMultipleNFTsResponseAdapter, getNFTContractMetadataOperation, GetNFTContractMetadataRequest, GetNFTContractMetadataResponseAdapter, getNFTContractTransfersOperation, GetNFTContractTransfersRequest, GetNFTContractTransfersResponseAdapter, getNFTLowestPriceOperation, GetNFTLowestPriceRequest, GetNFTLowestPriceResponseAdapter, getNFTMetadataOperation, GetNFTMetadataRequest, GetNFTMetadataResponseAdapter, getNFTOwnersOperation, GetNFTOwnersRequest, GetNFTOwnersResponseAdapter, getNFTTokenIdOwnersOperation, GetNFTTokenIdOwnersRequest, GetNFTTokenIdOwnersResponseAdapter, getNFTTransfersByBlockOperation, GetNFTTransfersByBlockRequest, GetNFTTransfersByBlockResponseAdapter, getNFTTransfersFromToBlockOperation, GetNFTTransfersFromToBlockRequest, GetNFTTransfersFromToBlockResponseAdapter, getNFTTransfersOperation, GetNFTTransfersRequest, GetNFTTransfersResponseAdapter, getWalletNFTCollectionsOperation, GetWalletNFTCollectionsRequest, GetWalletNFTCollectionsResponseAdapter, getWalletNFTsOperation, GetWalletNFTsRequest, GetWalletNFTsResponseAdapter, getWalletNFTTransfersOperation, GetWalletNFTTransfersRequest, GetWalletNFTTransfersResponseAdapter, reSyncMetadataOperation, ReSyncMetadataRequest, ReSyncMetadataResponseAdapter, syncNFTContractOperation, SyncNFTContractRequest, SyncNFTContractResponseAdapter, GetNFTTradesOperationResponseJSON, GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationResponse, GetNFTCollectionStatsOperationResponseJSON, GetNFTCollectionStatsOperation, GetNFTCollectionStatsOperationRequest, GetNFTCollectionStatsOperationResponse, GetNFTTokenStatsOperationResponseJSON, GetNFTTokenStatsOperation, GetNFTTokenStatsOperationRequest, GetNFTTokenStatsOperationResponse, getInternalTransactionsOperation, GetInternalTransactionsRequest, GetInternalTransactionsResponseAdapter, getTransactionOperation, GetTransactionRequest, GetTransactionResponseAdapter, getTransactionVerboseOperation, GetTransactionVerboseRequest, GetTransactionVerboseResponseAdapter, getWalletTransactionsOperation, GetWalletTransactionsRequest, GetWalletTransactionsResponseAdapter, getWalletTransactionsVerboseOperation, GetWalletTransactionsVerboseRequest, GetWalletTransactionsVerboseResponseAdapter, getNativeBalanceOperation, GetNativeBalanceRequest, GetNativeBalanceResponseAdapter, getNativeBalancesForAddressesOperation, GetNativeBalancesForAddressesRequest, GetNativeBalancesForAddressesResponseAdapter, getPairAddressOperation, GetPairAddressRequest, GetPairAddressResponseAdapter, getPairReservesOperation, GetPairReservesRequest, GetPairReservesResponseAdapter, GetPairPriceOperationResponseJSON, GetPairPriceOperation, GetPairPriceOperationRequest, GetPairPriceOperationResponse, getTokenAllowanceOperation, GetTokenAllowanceRequest, GetTokenAllowanceResponseAdapter, getTokenMetadataBySymbolOperation, GetTokenMetadataBySymbolRequest, GetTokenMetadataBySymbolResponseAdapter, getTokenMetadataOperation, GetTokenMetadataRequest, GetTokenMetadataResponseAdapter, getTokenPriceOperation, GetTokenPriceRequest, GetTokenPriceResponseAdapter, getTokenTransfersOperation, GetTokenTransfersRequest, GetTokenTransfersResponseAdapter, getWalletTokenBalancesOperation, GetWalletTokenBalancesRequest, GetWalletTokenBalancesResponseAdapter, getWalletTokenTransfersOperation, GetWalletTokenTransfersRequest, GetWalletTokenTransfersResponseAdapter, GetMultipleTokenPricesOperationResponseJSON, GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationBody, GetMultipleTokenPricesOperationResponse, GetTokenStatsOperationResponseJSON, GetTokenStatsOperation, GetTokenStatsOperationRequest, GetTokenStatsOperationResponse, resolveAddressOperation, ResolveAddressRequest, ResolveAddressResponseAdapter, resolveDomainOperation, ResolveDomainRequest, ResolveDomainResponseAdapter, resolveENSDomainOperation, ResolveENSDomainRequest, ResolveENSDomainResponseAdapter, ResolveAddressToDomainOperationResponseJSON, ResolveAddressToDomainOperation, ResolveAddressToDomainOperationRequest, ResolveAddressToDomainOperationResponse, runContractFunctionOperation, RunContractFunctionRequest, RunContractFunctionResponseAdapter, Web3ApiVersionOperationResponseJSON, Web3ApiVersionOperation, Web3ApiVersionOperationResponse, EndpointWeightsOperationResponseJSON, EndpointWeightsOperation, EndpointWeightsOperationResponse, ReviewContractsOperationResponseJSON, ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationBody, ReviewContractsOperationResponse, uploadFolderOperation, UploadFolderRequest, UploadFolderResponseAdapter, GetWalletHistoryOperationResponseJSON, GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationResponse, GetWalletTokenBalancesPriceOperationResponseJSON, GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationResponse, GetWalletNetWorthOperationResponseJSON, GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationResponse, GetWalletActiveChainsOperationResponseJSON, GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationResponse, GetWalletStatsOperationResponseJSON, GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationResponse, GetTopERC20TokensByMarketCapOperationResponseJSON, GetTopERC20TokensByMarketCapOperation, GetTopERC20TokensByMarketCapOperationResponse, GetTopERC20TokensByPriceMoversOperationResponseJSON, GetTopERC20TokensByPriceMoversOperation, GetTopERC20TokensByPriceMoversOperationResponse, GetTopNFTCollectionsByMarketCapOperationResponseJSON, GetTopNFTCollectionsByMarketCapOperation, GetTopNFTCollectionsByMarketCapOperationResponse, GetHottestNFTCollectionsByTradingVolumeOperationResponseJSON, GetHottestNFTCollectionsByTradingVolumeOperation, GetHottestNFTCollectionsByTradingVolumeOperationResponse, GetTopCryptoCurrenciesByMarketCapOperationResponseJSON, GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByMarketCapOperationResponse, GetTopCryptoCurrenciesByTradingVolumeOperationResponseJSON, GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesByTradingVolumeOperationResponse } from '@moralisweb3/common-evm-utils'; +import { getBlockOperation, GetBlockRequest, GetBlockResponseAdapter, getDateToBlockOperation, GetDateToBlockRequest, GetDateToBlockResponseAdapter, GetBlockStatsOperationResponseJSON, GetBlockStatsOperation, GetBlockStatsOperationRequest, GetBlockStatsOperationResponse, getContractEventsOperation, GetContractEventsRequest, GetContractEventsResponseAdapter, getContractLogsOperation, GetContractLogsRequest, GetContractLogsResponseAdapter, getContractNFTsOperation, GetContractNFTsRequest, GetContractNFTsResponseAdapter, getMultipleNFTsOperation, GetMultipleNFTsRequest, GetMultipleNFTsResponseAdapter, getNFTContractMetadataOperation, GetNFTContractMetadataRequest, GetNFTContractMetadataResponseAdapter, getNFTContractTransfersOperation, GetNFTContractTransfersRequest, GetNFTContractTransfersResponseAdapter, getNFTLowestPriceOperation, GetNFTLowestPriceRequest, GetNFTLowestPriceResponseAdapter, getNFTMetadataOperation, GetNFTMetadataRequest, GetNFTMetadataResponseAdapter, getNFTOwnersOperation, GetNFTOwnersRequest, GetNFTOwnersResponseAdapter, getNFTTokenIdOwnersOperation, GetNFTTokenIdOwnersRequest, GetNFTTokenIdOwnersResponseAdapter, getNFTTransfersByBlockOperation, GetNFTTransfersByBlockRequest, GetNFTTransfersByBlockResponseAdapter, getNFTTransfersFromToBlockOperation, GetNFTTransfersFromToBlockRequest, GetNFTTransfersFromToBlockResponseAdapter, getNFTTransfersOperation, GetNFTTransfersRequest, GetNFTTransfersResponseAdapter, getWalletNFTCollectionsOperation, GetWalletNFTCollectionsRequest, GetWalletNFTCollectionsResponseAdapter, getWalletNFTsOperation, GetWalletNFTsRequest, GetWalletNFTsResponseAdapter, getWalletNFTTransfersOperation, GetWalletNFTTransfersRequest, GetWalletNFTTransfersResponseAdapter, reSyncMetadataOperation, ReSyncMetadataRequest, ReSyncMetadataResponseAdapter, syncNFTContractOperation, SyncNFTContractRequest, SyncNFTContractResponseAdapter, GetNFTTradesOperationResponseJSON, GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationResponse, GetNFTContractSalePricesOperationResponseJSON, GetNFTContractSalePricesOperation, GetNFTContractSalePricesOperationRequest, GetNFTContractSalePricesOperationResponse, GetNFTSalePricesOperationResponseJSON, GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSalePricesOperationResponse, GetNFTCollectionStatsOperationResponseJSON, GetNFTCollectionStatsOperation, GetNFTCollectionStatsOperationRequest, GetNFTCollectionStatsOperationResponse, GetNFTTokenStatsOperationResponseJSON, GetNFTTokenStatsOperation, GetNFTTokenStatsOperationRequest, GetNFTTokenStatsOperationResponse, getInternalTransactionsOperation, GetInternalTransactionsRequest, GetInternalTransactionsResponseAdapter, getTransactionOperation, GetTransactionRequest, GetTransactionResponseAdapter, getTransactionVerboseOperation, GetTransactionVerboseRequest, GetTransactionVerboseResponseAdapter, getWalletTransactionsOperation, GetWalletTransactionsRequest, GetWalletTransactionsResponseAdapter, getWalletTransactionsVerboseOperation, GetWalletTransactionsVerboseRequest, GetWalletTransactionsVerboseResponseAdapter, getNativeBalanceOperation, GetNativeBalanceRequest, GetNativeBalanceResponseAdapter, getNativeBalancesForAddressesOperation, GetNativeBalancesForAddressesRequest, GetNativeBalancesForAddressesResponseAdapter, getPairAddressOperation, GetPairAddressRequest, GetPairAddressResponseAdapter, getPairReservesOperation, GetPairReservesRequest, GetPairReservesResponseAdapter, GetPairPriceOperationResponseJSON, GetPairPriceOperation, GetPairPriceOperationRequest, GetPairPriceOperationResponse, getTokenAllowanceOperation, GetTokenAllowanceRequest, GetTokenAllowanceResponseAdapter, getTokenMetadataBySymbolOperation, GetTokenMetadataBySymbolRequest, GetTokenMetadataBySymbolResponseAdapter, getTokenMetadataOperation, GetTokenMetadataRequest, GetTokenMetadataResponseAdapter, getTokenPriceOperation, GetTokenPriceRequest, GetTokenPriceResponseAdapter, getTokenTransfersOperation, GetTokenTransfersRequest, GetTokenTransfersResponseAdapter, getWalletTokenBalancesOperation, GetWalletTokenBalancesRequest, GetWalletTokenBalancesResponseAdapter, getWalletTokenTransfersOperation, GetWalletTokenTransfersRequest, GetWalletTokenTransfersResponseAdapter, GetMultipleTokenPricesOperationResponseJSON, GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationBody, GetMultipleTokenPricesOperationResponse, GetTokenStatsOperationResponseJSON, GetTokenStatsOperation, GetTokenStatsOperationRequest, GetTokenStatsOperationResponse, resolveAddressOperation, ResolveAddressRequest, ResolveAddressResponseAdapter, resolveDomainOperation, ResolveDomainRequest, ResolveDomainResponseAdapter, resolveENSDomainOperation, ResolveENSDomainRequest, ResolveENSDomainResponseAdapter, ResolveAddressToDomainOperationResponseJSON, ResolveAddressToDomainOperation, ResolveAddressToDomainOperationRequest, ResolveAddressToDomainOperationResponse, runContractFunctionOperation, RunContractFunctionRequest, RunContractFunctionResponseAdapter, Web3ApiVersionOperationResponseJSON, Web3ApiVersionOperation, Web3ApiVersionOperationResponse, EndpointWeightsOperationResponseJSON, EndpointWeightsOperation, EndpointWeightsOperationResponse, ReviewContractsOperationResponseJSON, ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationBody, ReviewContractsOperationResponse, uploadFolderOperation, UploadFolderRequest, UploadFolderResponseAdapter, GetWalletHistoryOperationResponseJSON, GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationResponse, GetWalletTokenBalancesPriceOperationResponseJSON, GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationResponse, GetWalletNetWorthOperationResponseJSON, GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationResponse, GetWalletActiveChainsOperationResponseJSON, GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationResponse, GetWalletStatsOperationResponseJSON, GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationResponse, GetTopERC20TokensByMarketCapOperationResponseJSON, GetTopERC20TokensByMarketCapOperation, GetTopERC20TokensByMarketCapOperationResponse, GetTopERC20TokensByPriceMoversOperationResponseJSON, GetTopERC20TokensByPriceMoversOperation, GetTopERC20TokensByPriceMoversOperationResponse, GetTopNFTCollectionsByMarketCapOperationResponseJSON, GetTopNFTCollectionsByMarketCapOperation, GetTopNFTCollectionsByMarketCapOperationResponse, GetHottestNFTCollectionsByTradingVolumeOperationResponseJSON, GetHottestNFTCollectionsByTradingVolumeOperation, GetHottestNFTCollectionsByTradingVolumeOperationResponse, GetTopCryptoCurrenciesByMarketCapOperationResponseJSON, GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByMarketCapOperationResponse, GetTopCryptoCurrenciesByTradingVolumeOperationResponseJSON, GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesByTradingVolumeOperationResponse } from '@moralisweb3/common-evm-utils'; import { NullableOperationResolver, OperationResolver, OperationV3Resolver, PaginatedOperationResolver, PaginatedResponseV3Adapter, PaginatedOperationV3Resolver } from '@moralisweb3/api-utils'; import { ApiModule, ResponseAdapter } from '@moralisweb3/common-core'; export abstract class ClientEvmApi extends ApiModule { @@ -80,6 +80,12 @@ export abstract class ClientEvmApi extends ApiModule { getNFTTrades: (request: GetNFTTradesOperationRequest): Promise> => { return new PaginatedOperationV3Resolver(GetNFTTradesOperation, this.baseUrl, this.core).fetch(request, null); }, + getNFTContractSalePrices: (request: GetNFTContractSalePricesOperationRequest): Promise> => { + return new OperationV3Resolver(GetNFTContractSalePricesOperation, this.baseUrl, this.core).fetch(request, null); + }, + getNFTSalePrices: (request: GetNFTSalePricesOperationRequest): Promise> => { + return new OperationV3Resolver(GetNFTSalePricesOperation, this.baseUrl, this.core).fetch(request, null); + }, getNFTCollectionStats: (request: GetNFTCollectionStatsOperationRequest): Promise> => { return new OperationV3Resolver(GetNFTCollectionStatsOperation, this.baseUrl, this.core).fetch(request, null); },